![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| getopts alternative? | krishmaths | Shell Programming and Scripting | 3 | 04-05-2008 10:43 PM |
| Alternative to date +%s | Data469 | HP-UX | 6 | 03-31-2008 12:28 PM |
| Using awk (or an alternative) | michaeltravisuk | Shell Programming and Scripting | 5 | 03-08-2007 07:37 PM |
| .NET Alternative | goon12 | UNIX for Dummies Questions & Answers | 3 | 04-06-2005 09:07 AM |
| loop alternative? | apalex | Shell Programming and Scripting | 2 | 05-02-2002 09:47 AM |
|
|
Submit Tools | LinkBack | Thread Tools | 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 |
| Forum Sponsor | ||
|
|
|
|||
|
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:
|
|||
| Google The UNIX and Linux Forums |