Text Processing Using cut Command
Cut command allows us to cut part of a text from a file. For example, the below file contains three fields on each line if we consider the ":" as the field separator. The first field contains some names. The second field contains some numbers and the third field contains names of fruits. Suppose we want to cut all the names from each line of that file.
1. Contents of cutsample1.txt
Cut command allows us to cut part of a text from a file. For example, the below file contains three fields on each line if we consider the ":" as the field separator. The first field contains some names. The second field contains some numbers and the third field contains names of fruits. Suppose we want to cut all the names from each line of that file.
1. Contents of cutsample1.txt
2. Cutting only the name from file(Only the first field)
In the above command we specified the ":" as the delimiter(field separator) and we selected the field 1
3.Cutting the third field from the file
3.Cutting the third field from the file
4.Cutting first and second field.
Cutting fields from another file.
Content of cutsample2.txt
Content of cutsample2.txt
Cutting the first field from the file, We specified the delimiter as the "#"
Cutting the first and third field.