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 IamaSherpa 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. keepitsimplestupid

    Editing log file using AWK

    I guess you could try gawk instead. For debug, replace if(n != 3) next with if(n != 3) { printf("DEBUG: timestamp in wrong format\n") next } and if(n != 10) next with if(n != 10) { printf("DEBUG: counts in wrong format\n") next }
  2. keepitsimplestupid

    Editing log file using AWK

    Adding to your grep (but of course awk can do the grep): grep 'Session statistics: Requests' * | awk ' BEGIN { FieldFormat = "%-30s %-25s %6s %7s %7s %6s\n" printf(FieldFormat,"Job","Time","Added","Updated","Deleted","Errors")...
  3. keepitsimplestupid

    first post, matching, backing up, and matching forward again.

    # code_block.awk # # modified to output timestamp once per matching block # # match the timestamp # # Sample: # Sat Jan 31 01:56:15 2009(abcd .... wxyz)test_has_passed(abcd .... wxyz) match($0,/^... ... .. ..:..:.. ..../) { sub("\r\n","") LastTime = substr($0,RSTART,RLENGTH)...
  4. keepitsimplestupid

    first post, matching, backing up, and matching forward again.

    # code_block.awk # match the timestamp # # Sample: # Sat Jan 31 01:56:15 2009(abcd .... wxyz)test_has_passed(abcd .... wxyz) match($0,/^... ... .. ..:..:.. ..../) { sub("\r\n","") LastTime = substr($0,RSTART,RLENGTH) next } # print lines found with wq15 until blank or 0D 0A ... #...
  5. keepitsimplestupid

    first post, matching, backing up, and matching forward again.

    I forgot to add "next"'s to skip other lines, so add "next" before each closing brace, and add { next } to skip other lines.
  6. keepitsimplestupid

    first post, matching, backing up, and matching forward again.

    If all you care about is the timestamp to be output whenever your pattern matches, then just keep the last recognized timestamp in a variable of its own and print it when you get your pattern. Something like: /^... ... .. ..:..:.. ..../ { #adjust RE to match better...
  7. keepitsimplestupid

    Extract single string from a file

    awk '/RRV112F2_/ { print } {next}' wibble.lis

Part and Inventory Search

Back
Top