Hi All,
How to remove col1 and last column in a line. Please suggest some awk stuffs.
Input
col1 col2 col3 col4
col1 col2 col3 col4 col5
col1 col2 col3 col4
col1 col2 col3
Output
Processing col2 col3 ...
Processing col2 col3 col4 ...
Processing col2 col3 ...
Processing col2 ...
Thanks,
Mani Muthu
awk -F' ' '{printf "processing "; for(i=2;i<NF;i++){ printf "%s ",$i}; print "..."}' file_name
awk '{NF=NF-1;$1=$1;sub(".*"$2,$2,$0)}1' infile
use nawk instead of awk if running on SunOS / Solaris plateform
thanks for your solutions. How to store the col2 to col n-1 in a variable
What is your final goal ?
awk '{NF=NF-1;$1=$1;sub(".*"$2,$2,$0);print "Processing",$0}' infile
I am trying to extract .rar format files in solaris.
I am using the a utility to extract the files.
While I am extracting a rar file it shows the below message
Extracting folder1/folder 2/file OK
Insist of the above message I want to show the below message
Processing folder1/folder 2/file ...
Suppose a path having some space, then $2 getting the partial path name only.
I want to show the full path name.