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: *

  • Users: Ygor
  • Order by date
  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}'
  16. Ygor

    Data transformation; problem with newline in field

    The trouble is, you now have 5 tab-separated fields instead of 4, or you may have 6 or 7, depending on the address data. What you would need to do is define an output record with a fixed number of address lines, e.g. assuming a maximum of 3 lines....gawk ' BEGIN { ORS = RS = "\n\r"...
  17. Ygor

    Data transformation; problem with newline in field

    This changes any "\n" to "\t" in $2...$ od -c file1 0000000 K e v i n \t 1 2 3 c h e r r y 0000020 w a y \n A p t 2 1 \t h o u s 0000040 t o n \t T X \n \r 0000050 $ gawk...
  18. Ygor

    Sed and regular expression

    Try...awk '$1=="LIPID"{f=$2%2}$1=="SPECIES"&&!f{$2=-1*($2-1)}1' Test1.txt > OP.txt
  19. Ygor

    print from pattern1 to pattern2 but not pattern2

    Perhaps try...awk '$1~s' RS='>' s='11S2_SESIN' file.fastWhich gives...11S2_SESIN MVAFKFLLALSLSLLVSAAIAQTREPRLTQGQQCRFQRISGAQPSLRIQSEGGTTELWDE RQEQFQCAGIVAMRSTIRPNGLSLPNYHPSPRLVYIERGQGLISIMVPGCAETYQVHRSQ RTMERTEASEQQDRGSVRD
  20. Ygor

    Sleep time limit

    Try this logic...#----wait for file to arrive, but time out at 10am while [[ ! -s $DATA_DIR/test2.das && $(date '+%H:%M') < 10:00 ]] do sleep 900 done #----check for file if [[ -s $DATA_DIR/test2.das ]] then : file arrived, do something else : must have timed-out, so send email fi

Part and Inventory Search

Back
Top