Shazin
1
Hi all,
I am using the below command to shift the lines in a file which was advised by Anchal in this forum:
awk -v total_records=$(cat redirects.virgin-atlantic.com.conf | wc -l) '{ if(NR>(total_records - 2)) printf "\t%s\n", $0; else print $0 }' align
but I am getting the below error:
awk: syntax error near line 1
awk: bailing out near line 1
but for anchal it is working fine.
The OS I am using for Unix is:
SunOS 5.8 Generic_108528-23 sun4u sparc SUNW,Sun-Fire-280R
Please can somebody advise.
Best Regards,
Shazin
Scott
3
I would guess that the wc -l is returning leading spaces
Try
total_records=$(echo $(cat redirects.virgin-atlantic.com.conf | wc -l))
Useless Use of Cat!
total_records=$(wc -l < redirects.virgin-atlantic.com.conf)
Regards
Scott
6
Did you try it with /usr/xpg4/bin/awk?
It works fine with that.
clx
7
Hi all,
Please follow the original thread.
Shazin: Posting again will only start assumptions from the beginning.
zaxxon
8
Thread closed, warning given to stay in old thread with same problem - Please continue where anchal_khare refers to, ty.