Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. yesornot

    collecting exit code on variable

    thank you. btw. in ksh93g+, which does not have PIPESTATUS I found another trick for getting exit code $ ls missing 2>&1|sed s/^/error:\ /g error: ls: 0653-341 The file missing does not exist. $ echo $? 0 $ set -o pipefail $ ls missing 2>&1|sed s/^/error:\ /g error: ls: 0653-341 The file...
  2. yesornot

    collecting exit code on variable

    why red echo does not return '2' while green one does? $ unset C $ { ls missing 2>&1;C=$?; } ls: 0653-341 The file missing does not exist. $ echo $C 2 $ unset C $ { ls missing 2>&1;C=$?; }|sed s/^/error:\ /g error: ls: 0653-341 The file missing does not exist. $ echo $C $
  3. yesornot

    awk simple code

    just want someone confirm there is no error in my micro awk code below * if given on "f" not exists in input, then print not exists * if given on "f" exists and given on "s" is greater than number in file a, print 'too small' $ cat a 200 /f1 300 /f2 500 /f4 $ awk -vf=/f5 -vs=400 'BEGIN {c=0}...
  4. yesornot

    getting rid of tailing zeroes in floating number

    ok, this worked awk '{if($0~/\./){sub("0*$","",$0);sub("\\.$","",$0);}print}'
  5. yesornot

    getting rid of tailing zeroes in floating number

    $ echo 4000.24320000000000223230000|sed s/0*$//g 4000.2432000000000022323 (ok) $ echo 4000.0000|sed s/0*$//g 4000. (not ok - expected 4000) $ echo 4000|sed s/0*$//g 4 (not ok - expected 4000)
  6. yesornot

    awk syntax error

    thank you - also ; was causing error print {"obsolete";exit}; replaced with {print "obsolete";exit} and it works now.
  7. yesornot

    awk syntax error

    hi expected is to print single 'obsolete' or single 'input error' text (when conditions are met), but for the first if condition print (in this example): 1 3 fields, a>10 2 3 fields, a>10 what is wrong with "exit" in code below? # echo "a b c\na b c"|awk -va=11 '{if (NF==3&&a>10) print NR,NF"...

Part and Inventory Search

Back
Top