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. udaybo

    Conditions with AWK

    Another script regarding the same file Script:awk 'NR%3 == 1 {s = $0} NR%3 == 2 {print s > ("file_" ($1 ~ /1$/ ? 1 : 2))} ' file I have a file (A.txt) with below data (it's not sample, i will always have five lines of data) but they are timestamps and the second and fifth lines (H180620081 &...
  2. udaybo

    Conditions with AWK

    Thank you
  3. udaybo

    Conditions with AWK

    Hi PH, I was trying something like below (I am a Business Objects Developer and I am very new to scripting) awk 'substr($1,length($1))="1"{$(NF+1)="XXXX"}' file Thanks again
  4. udaybo

    Conditions with AWK

    Hello all I have a file with below data, I need to add a third column as XXXX if the first coloumn (H180620081) last number is "1" and YYYY if the first coloumn last number is "2" Can it be done with AWK, I would appreciate if anyone could help me ou with this. H180620081 31310 H180620082...
  5. udaybo

    Assigning Field names with AWK or SED (Newbie)

    THANK YOU PHV and LKBrwnDBA, you guys are wonderful, thanks again.
  6. udaybo

    Assigning Field names with AWK or SED (Newbie)

    Hello PH, Below is the real content of F.txt STRT ~ 5~NEWPORT NEWS ~VA ~23606 ~TM14~8506~1485 STRT ~ A~NEWPORT NEWS ~VA ~23602 ~TM15~8802~1588 STRT ~ ~NEWPORT NEWS ~VA ~23602 ~TM15~9002~1590 STRT ~ ~POQUOSON ~VA ~23662 ~TM17~8362~1783 STRT ~ ~POQUOSON...
  7. udaybo

    Assigning Field names with AWK or SED (Newbie)

    The output doesn't change, it is same as the input file even after running the above script for assigning field names and Header to the file. STRT~ VA ~23662 ~TM17~8362~1783 STRT~ VA ~23662 ~TM17~8362~1783 STRT~ VA ~23662 ~TM17~8362~1783 STRT~ VA ~23662 ~TM17~8362~1783 (input file) Thank you UD
  8. udaybo

    Assigning Field names with AWK or SED (Newbie)

    Thank you PH, I ran the script, but get expected output, may be I am doing it wrong (I am very new to Unix scripting) awk ' /page /{ print "------------------HEADER-------------------" print "--A------B------C--------D------E-----F----(Field names)" } { print }' F.txt > H.txt Thanks again
  9. udaybo

    Assigning Field names with AWK or SED (Newbie)

    Hello, Please HELP I have a text file in below format, how can I put a header and assign field names to the file with either AWK or SED. STRT~ VA ~23606 ~TM14~8506~1485 (page 1) STRT~ VA ~23662 ~TM17~8362~1783 (page 2) STRT~ VA ~23662 ~TM17~8362~1783 STRT~ VA ~23662 ~TM17~8362~1783 STRT~...
  10. udaybo

    How to sort and put a page break on a text file

    Thank you PH I am gonna run my script through KSH and send the text file to a particular location, so that the users could print out the file. Thanks
  11. udaybo

    How to sort and put a page break on a text file

    Thanks for you reply Annihilannic, by page break I meant, when I print the report each group after the sort should be printed in a different page. I am very new to AWK, I am not even sure if that could be done or not. Thanks again
  12. udaybo

    How to sort and put a page break on a text file

    Thank you, I got the sort working, but the page break isn't. Thanks again for your help
  13. udaybo

    How to sort and put a page break on a text file

    Hello, I have a text file like below example, I would like to do a sort by the last field and put a page break after each group How can I do this using sed or awk VA 23602 TM15 8802 1588 VA 23606 TM14 8506 1486 VA 23662 TM17 8362 1783 VA 23662 TM17 8362 1588 VA 23188 TM60 9188 6091 VA...
  14. udaybo

    How to set fieldsize in a text file using SED or AWK

    Thank you PHV
  15. udaybo

    How to set fieldsize in a text file using SED or AWK

    Hello all I have a file and I oly want lines starting with a certain character ex: 'S' how do I do it in Awk or Sed start xxxxxxxx stop xxxxxxxxx 1234 xxxxxxx start xxxxxxx Thank you
  16. udaybo

    Not able to run a AWK script in korn Shell

    Thank you LKBrwn, I ran the below script and it ran fine. /usr/bin/nawk -F'~' '{printf "%010d%-8s%-------------- Thanks Again for your help
  17. udaybo

    Not able to run a AWK script in korn Shell

    Thank you, it works but when I use the same logic on a larger script it does not. Don't know why awk -F'~' '{printf...
  18. udaybo

    Not able to run a AWK script in korn Shell

    Hello, The below AWK script runs fine in unix , but when I try to run the same in korn shell it gives me an error awk 'BEGIN {FS="~"};{printf "%010d%-8s%09s\n",$1,$2,$3}' $DC_FIL/red2.txt > $DC_FIL/red3.txt errors: Syntax error near line 1 Bailing out near line 1 Can anybody please help me...
  19. udaybo

    How to convert Ph # format from (xxx)-xxx-xxxx to xxxxxxxxxx

    Hello all I am new to scripting, I am workng on a text file where I have a field for phone numbers, but these phone numbers are in different format. Can we convert ph# format(xxx)-xxx-xxxx to xxxxxxxxxx. Can anyone please help me with this. Thanks a Lot

Part and Inventory Search

Back
Top