10.142.7.155 - - [02/Jun/2010:01:22:07 -0700] www.abc.com 404 -
I have many columns which is tab delimited file, I have to re-arrange this to a particular column and also add "-" to 3rd column and 6th column.
10.142.7.155 - - - www.abc.com - 404 - [02/Jun/2010:01:22:07 -0700]
awk '{print $1,$2,$3" -",$6" -",$7,$8,$4,$5}' infile
anbu23
3
Use awk command
awk ' { print $1, $2, $3, "-", $6 } ' file
Add other fields in the order you need
awk '{print $1,$2,$3" -",$6" -",$7,$8,$4,$5}' file.txt column is splitted based based on the space. File.txt is the tab delimited file
awk -F"\t" -vOFS="\t" '{print $1,$2,$3"\t-",$6"\t-",$7,$8,$4,$5}' infile