cut

remove sections from each line of files

copy
43
1
cut -d ' ' -f1,2 /etc/mtabCut /etc/mtab on fields 1,2 using space as a delimiter.

details |

copy
14
2
echo "abcdefghijklmnopqrstuvwxyz" | cut -c 5-Cut everything after the 4th character

details |

copy
20
1
uptime |cut -d , -f 1 | cut -c 2-Cut uptime, using , as a delimiter removing the leading space with another cut

details |

copy
15
0
cut -c3 file | paste - fileCut characters in the third column of file, and paste them back as the first column in the same file

details |

copy
21
2
uname -a | cut -d" " -f1,3,11,12cut Linux gobo 2.6.27.7-smp #2 SMP Thu Nov 20 22:32:43 CST 2008 i686 Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz GenuineIntel GNU/Linux using space as a delimiter on fields 1,3,11,12

details |

copy
11
1
echo "This is a test" | cut -f1 -d' 'Cut the string before the first space

details |

copy
4
1
cat /etc/passwd |cut -d: -f6cat the /etc/passwd file cutting the 6 field using : as a delimiter.

details |

copy
10
1
date | cut -b 1-3cut the first 3 bytes form Sat Mar 14 21:44:19 EDT 2009

details |

copy
6
1
echo "a|b|c|d|e" | cut -f 3- -d \|Cut 3 fields and use | as a delimiter.

details |

copy
11
1
who | cut -d" " -f1To find out the users that are currently logged in

details |