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

  • Users: pb0y
  • Order by date
  1. pb0y

    multiple line records

    Grant, New logic works great! Thanks for all your help.
  2. pb0y

    multiple line records

    Grant, There are mutliple instances of ":RECORD 1" (when I say :RECORD 1, specifically it is a "1" and not some other RecNo in the table.) As such the exit statement will exit the program before all the records are returned if it finds a "RECORD 1" before the end...
  3. pb0y

    multiple line records

    Thanks Grant! I made a slight modification (NF>=3) since there could be 3 or 4 fields in the record. There is a problem sometimes the file gets messed up and empty records are added to it, when this happens if the last record is as such, the array example you provided will not work. How can I...
  4. pb0y

    multiple line records

    Hi CaKiwi and marsd, Sorry for not being clear. What I am trying to do is this: If :RECORD 1 has X in field 2 lines below it (X being some number which is a shell variable) then print :RECORD 1, not the actual line with the X on it. If X appears in field 2 in a record it will appear on every...
  5. pb0y

    multiple line records

    Hi, I want to return all the record numbers, between TABLENAME and END pairs, if it finds a match for X in field2 of that record. The layout is as follows: :TABLENAME :RECORD 1 ; Field2 Field3 Field 4 01, X, 99, 4321 02, X, 99, 4322 03, X, 99, 4323 04...
  6. pb0y

    awk script improvement

    works great! thanks!!
  7. pb0y

    awk script improvement

    More info: I am scanning certain tables in a comma-delimited file for some number (shell variable $1) in the 3 field of each record and then getting the index number of that record (field $1) when it finds a match. Then printing the output of the record under a table heading for each field...
  8. pb0y

    awk script improvement

    I am running the following programs within one script. It works, however I would like a more professional way than to than to run 5 separate instances of awk. Any insight would be greatly appreciated. Thanks. nawk '/TABLE1/, /:TABLE2/' file | nawk -v X=$1 'BEGIN {FS=","} $3==X...
  9. pb0y

    shell variable false positives

    thanks!
  10. pb0y

    shell variable false positives

    Hi, I am scanning certain tables in a comma-delimited file for some number (shell variable $1) in the 3 field of each record and then getting the index number of that record (field $1) when it finds a match. nawk '/table1/, /table2/' tempfile | nawk -v X=$1 'BEGIN {FS=","} $3 ~ X...
  11. pb0y

    awk user defined variable help

    nawk worked thanks!
  12. pb0y

    awk user defined variable help

    The variable declaration is working. The argument does not. X=1234 cat tmpfile | awk -v awkX=${X} '$13 ~ awkX {print $0}' + cat tmpfile + awk -v awkX=1234 $13 ~ awkX {print $0} awk: syntax error near line 1 awk: bailing out near line 1
  13. pb0y

    awk user defined variable help

    Thanks for your suggestion, however it seems there is a typo? I get awk: syntax error near line 1 awk: bailing out near line 1
  14. pb0y

    awk user defined variable help

    X=some number cat tmpfile | awk '$13~/"$X"/{print $0}' what i want to do is to take a user defined variable and match it to field $13 in a text file. If the match is true then print the entire line. However, I don't seem to have the syntax correct for awk to understand $X is a...
  15. pb0y

    awk loop to delete lines ina file

    thanks i got it to work like this while [ $X != 1 ] do X=`expr $X - 1` head -$X $FileA |tail +$X > $FileB done
  16. pb0y

    awk loop to delete lines ina file

    Hi I need assistance with a loop routine that counts the number of lines in a file then extracts the last line into a new file. The problem I am running into is the number of lines in file A will be dynamic. I need a way to subtract the lines in File A one at a time and output them into File...

Part and Inventory Search

Back
Top