awk / cut: Skip First Two Fields and Print the Rest of Line

To skip the first two fields and print the rest of the line using awk or cut, you can use the following command:

With awk:

$ awk '{$1=$2=""; print $0}' input_file

With cut:

$ cut -d' ' -f3- input_file

Replace input_file with the name of your input file. The awk and cut commands will read the input file line by line, skip the first two fields (delimited by spaces), and print the rest of the line. The output will be displayed on the terminal.

Note that the above commands assume that the fields in the input file are delimited by spaces. If the fields are delimited by a different character, you’ll need to adjust the -d option in the cut command accordingly.

Leave a Comment