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 &...
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
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...
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
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
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~...
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
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...
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
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...
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.