![]() |
|
|
|
|
|||||||
| 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 |
| Dynamically ftp'ing a file | pyaranoid | UNIX for Advanced & Expert Users | 0 | 09-02-2007 04:34 AM |
| Moving Part of a field to another field using AWK | rjsha1 | Shell Programming and Scripting | 5 | 08-04-2006 02:39 AM |
| dynamically loaded libraries | rainshadow | High Level Programming | 3 | 06-04-2005 09:31 PM |
| dynamically linked file | sveera | UNIX for Advanced & Expert Users | 5 | 06-03-2005 11:52 AM |
| Dynamically loading a module | yanhu | High Level Programming | 2 | 04-19-2004 10:07 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
getting value from field dynamically
how i do pass in field number when cutting, I tried to do this:
Quote:
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
$ var=1 $ echo $((var+1)) 2 $ echo `expr $var + 1` 2 $ echo "$var + 1" | bc 2 |
|
#3
|
|||
|
|||
|
it says ranges must be increasing..you mean you can't do a decrement?
|
|
#4
|
|||
|
|||
|
Code:
a=1 b=5 echo $line | tr -s " " | cut -d " " -f$a-$b |
|
#5
|
|||
|
|||
|
Code:
$ tmp="ABC 123 XYZ 890" $ t=3 $ echo $tmp | cut -d" " -f $(echo $t) XYZ $ echo $tmp | cut -d" " -f $(expr $t - 1) 123 $ |
|
#6
|
|||
|
|||
|
is it possible to do it without using two variables? i want to get last two fields of the line
|
|
#7
|
|||
|
|||
|
Code:
echo 'a b c d e f' | cut -d' ' -f 4- |
|||
| Google The UNIX and Linux Forums |