Tuesday, July 24, 2012

Inserting column [with value] at a given position in a file using AWK [1 liner]

very useful:
awk -v FS='|' -v OFS='|' '{$3=$3"|"4} 1' 1.txt 

Input:
1|2|3|5 
1|2|3|5 
1|2|3|5 
1|2|3|5 

Output:
1|2|3|4|5 
1|2|3|4|5 
1|2|3|4|5 
1|2|3|4|5 

No comments:

Post a Comment