![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reversing file order using SED | MBGPS | Shell Programming and Scripting | 3 | 01-07-2009 10:10 AM |
| disabiling telnet and ftp from reversing DNS | aladdin | UNIX for Advanced & Expert Users | 1 | 06-27-2007 06:40 PM |
| output string in reversing order | ccp | Shell Programming and Scripting | 3 | 11-19-2005 11:05 AM |
| Reversing UID's | dreaming1 | UNIX for Dummies Questions & Answers | 3 | 03-16-2005 07:36 PM |
| reversing a list | TioTony | Shell Programming and Scripting | 8 | 10-14-2002 05:00 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
awk and reversing
Hello
I'm writing script in awk that reverse order the fields of every line in file. My script have problem with spaces - if there is more spaces between fields in line of file - my script erase them . I want my script work like command "tac" - how to change it ? Code:
#!/bin/sh
file=$1
awk '
{
for(i=NF;i>0;i--)
printf("%s " , $i); printf("\n")
} ' $file
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|