4
rated 0 times
[
4]
[
0]
/ answers: 1 / hits: 780
/ 1 Year ago, fri, february 24, 2023, 12:04:05
To print the fields at 29th column in two files I used
paste <(awk -F, '{print $29}' PreRefFile.csv) <(awk -F, '{print $29}' Txlog.csv)
This worked fine.
To print all the fields starting from 29 to 189. I wrote a script as follows
y=29
while [ $y -le 189 ]
do
x="$$y"
paste <(awk -F, '{print "'"$x"'"}' PreRefFile.csv) <(awk -F, '{print "'"$x"'"}' Txlog.csv)
y=`expr $y + 1`
done
Here the value of x is replaced by "$" followed by number (First round of substitution) and it is printing "$" follwed by that number instead of printing the field at that location. How to get that field in this way.
I cannot write the same line for so many times. Suggest a method to proceed.
Also suggest another tool to do this, other than awk
More From » command-line