![]() |
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 |
| getopts alternative? | krishmaths | Shell Programming and Scripting | 3 | 04-06-2008 01:43 AM |
| Alternative to date +%s | Data469 | HP-UX | 6 | 03-31-2008 03:28 PM |
| Using awk (or an alternative) | michaeltravisuk | Shell Programming and Scripting | 5 | 03-08-2007 11:37 PM |
| .NET Alternative | goon12 | UNIX for Dummies Questions & Answers | 3 | 04-06-2005 12:07 PM |
| loop alternative? | apalex | Shell Programming and Scripting | 2 | 05-02-2002 12:47 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I'm trying the following as i wish to get the last field in a report containing several fields, each line can have more fields than the previous, so I tried
rvwords=`echo $rvstatus |wc -w` rvstat=`echo $rvstatus |cut -f $rvwords` but it prints the whole variable contents of $rvstatus rather than just the seventh field, there are no delimeters (other than spaces / tabs) in the line, which would read along the lines of 0 1111 my file 102.00 1003.00 2.99 1 2222 my own file 111.00 112.98 200.10 ... Thanks in anticipation |
|
||||
|
Quote:
|
|
|||||
|
Quote:
Code:
# 4th AND 5th from last
rvstat=`echo $rvstatus | nawk '{print $(NF-4), $(NF-5)}'`
# 4th from last
rvstat=`echo $rvstatus | nawk '{print $(NF-4)}'`
|
|
||||
|
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|