CUT
cut command select select section of text from each line of line . You can use the cut command to select fields or columns from a line
examples..
3.You can print a range of characters in a line by specifying the start and end position
cut c2-5 a.txt
4.To print the characters from tenth position to the end, specify
cut -c<position>- <txt file>
cur -c5- a.txt
cut command select select section of text from each line of line . You can use the cut command to select fields or columns from a line
examples..
- select particular word in each lines
cut -c<which word 1,2,3> <file name>
(cut -c3 a.txt)
2.select multiple word in each lines
cut -c2,3 a.txt
2nd and third word in each line
3.You can print a range of characters in a line by specifying the start and end position
cut c2-5 a.txt
4.To print the characters from tenth position to the end, specify
cut -c<position>- <txt file>
cur -c5- a.txt
5.Given a tab delimited file with several columns (tsv format) print the first three fields.
cut -f-3
6.Given a sentence, identify and display its first three words. Assume that the space (' ') is the only delimiter between words.
first awk'{print $1,$2..}'
or
cut -d ' ' -f1-3
7.Write a unix/linux cut command to print the fields using the delimiter
cut -d' ' -f2 a.txt
cut -d' ' -f2,3 file.txt
8,Write a unix/linux cut command to display range of fields?
cut -d' ' -f1-3 a.txt
Comments
Post a Comment