Hello Guys ,
I need an another help regarding the below problem.
I want to create a new file based on the existing file ,where two columns will be changed according to user input .(say column 4 and column 5)
Please let me know how to proceed with
Thanks
rdcwayx
2
a=4
b=5
awk -v x=$a -v y=$b '{print $x, $y}' infile
Hi ,
thanks for your reply but somehow my req is different .
suppose a file structure is like
12 123 432 5564 567
13 134 445 8845 653
-- ---- --- ----- ----
and so on
now the o/p file will be
12 555 666 5564 567
13 555 666 8845 653
-- ---- --- ----- ----
and so on
here 2nd and 3rd column value i/p has been done by user ,rest columns remain same
Please let me know how its possible
rdcwayx
4
Always 2nd and 3rd column?
run the script
Pratik4891.sh 555 666
cat Pratik4891.sh
#! /usr/bin/bash
awk -v s1=$1 -v s2=$2 {$2=s1;$3=s2}1' infile