Reputation: 1
One text file:
1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;@;
17;18;19;20;21;22;23;24;25;26;27;28;29;30;31;32;@;
etc..
Want to add '/c_h/' to every column 15
Want the results to be:
1;2;3;4;5;6;7;8;9;10;11;12;13;14;/c_h/15;16;@;
17;18;19;20;21;22;23;24;25;26;27;28;29;30;/c_h/31;32;@;
etc..
I was using awk but couldn't figure it out
Upvotes: 0
Views: 32
Reputation: 553
Try this command:
awk -v FS=";" -v OFS=";" ' { $15 = "/c_h/"$15 ; print $0 } ' file.txt
First of all, you need to set your input field separator and output field separator to be ";" in this case. Then just modify the field you want.
Upvotes: 1
Reputation: 31250
sed -r -e 's/(([0-9]+;){14})/\1\/c_h\//' YourFileName
To do it inline
sed -r -e 's/(([0-9]+;){14})/\1\/c_h\//' -i.bak YourFileName
Upvotes: 0