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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by Ygor

  1. Ygor

    SQL help with time difference

    Oh. And you don't need a range table.
  2. Ygor

    SQL help with time difference

    Shame that the WIDTH_BUCKET function doesn't quite fit the requirements. It's got such a great name! SQL> SELECT decode(wb, 11, 'Over 120 hrs', 'Between ' || (wb - 1) * 12 || ' and ' || wb * 12 || ' hours.') rng, 2 COUNT(0) cnt 3 FROM (SELECT width_bucket((shipped_date -...
  3. Ygor

    Rename a file

    Try...for i in *.txt; do mv $i $(expr $i : '.........\(.*\)'); done
  4. Ygor

    delete column

    Unless you have to use awk, perhaps consider using cut, e.g...cut -f-39,41-49,51- file.dat > newFile.dat
  5. Ygor

    regex help needed

    Or you can use bash to remove matched strings from a variable, e.g...$ JUNK="item1 item2 item3" $ JUNK=${JUNK//item2/} $ echo $JUNK item1 item3 $ JUNK=${JUNK//item3/} $ echo $JUNK item1
  6. Ygor

    regex help needed

    Perhaps you could use cut...$ echo $JUNK item1 item2 item3 $ echo $JUNK | cut -d ' ' -f 1,2 item1 item2 $ echo $JUNK | cut -d ' ' -f 3 item3
  7. Ygor

    Calculate Time

    Cross-post: thread271-1344125
  8. Ygor

    Extract valors and time calculation

    Try...awk '/LAM/{ split($6,a,/[:,]/) x = a[1]*3600 + a[2]*60 + a[3] "." a[4] getline getline split($6, a, /[:,]/) y = a[1]*3600 + a[2]*60 + a[3] "." a[4] z = y - x + (x>y?86400:0) printf "%02d:%02d:%02.3f\n"...
  9. Ygor

    round off problem

    Perhaps a problem with the output format, otherwise I don't see any problems...awk -v a=50.5555333 -v b=20.00 -v OFMT=%.7f 'BEGIN{print a - b}'...gives... 30.5555333
  10. Ygor

    remove after decimal place and switch fields

    Try...awk '{printf "%d %s\n", $2, $1}' file1 > file2
  11. Ygor

    Comment more than one line in vi

    You can "comment" several lines in a script like this... command1 : << COMMENT! command2 command3 COMMENT! command4 This prevents command2 and command3 from running.
  12. Ygor

    Prepend and Append to a field

    Try.. awk 'BEGIN { FS = OFS = "|" } { $4 = "http://www.domain.com/images/" $4 ".jpg" print $0 } ' file1 > file2
  13. Ygor

    awk I think!!

    Syntax for csplit is...$ csplit -f 'outfile.' -n 3 infile '/^h/' '{*}' 0 102 136 170 102 136 170 $ head outfile.* ==> outfile.000 <== ==> outfile.001 <== h1234567890 1234567890 1234567890 dqwertyuiop qwertyuiop qwertyuiop t0987654321 0987654321 0987654321 ==> outfile.002 <== h1234567890...
  14. Ygor

    awk I think!!

    All you need to do is match your header records to a pattern, e.g. assuming all header records begin with "h"...$ awk '/^h/{close(f); f=sprintf("outfile.%03d",++n)}{print $0 > f}' infile $ head outfile.* ==> outfile.001 <== h1234567890 1234567890 1234567890 dqwertyuiop qwertyuiop qwertyuiop...
  15. Ygor

    Awk help

    Try... awk '{print NR, $0}' cars|sort -d -k2|awk '{print NR, $0}'|sort -n -k2|awk '{print $1,$3}'

Part and Inventory Search

Back
Top