Thanks anbu23,
i just get it, and your post give me a shorter script, thanks buddy.
the awk script at first was created earlier to modified different spool file. So, i thought editing it would be less time consuming. but i wrong. final solution just come out after referring to your post. Thanks again.
hi,
sorry, again i noticed there are white spaces (or spaces) in the header text.
i used anbu23's example script and edited. and this is the result:
* indicated spaces, which maybe, from `wc -l`, i guessed. It also hold 8(plus 999) digits, which i prefer 7 only (****999).
the white spaces can be replace by 0 which mean if seven digits, it will be like this 0000999 and if 1000, like this 0001000
here is the script which is from anbu23, i made small editing.
Any help,solution to this small matter, i newbie in awk and sed, so, thanks in advances
Thank alot...anbu23.
it work well, and i must keep an eye of the output.
as i am trying this sed, it come to cross my mind that why,
instant of writing it on the same line?
at 1st i tried it and there are errors.
Thank alot...anbu23.
it work well, and i must keep an eye of the output.
as i am trying this sed, it come to cross my mind that why,
instant of writing it on the same line?
at 1st i tried it and there are errors.
Thank alot...anbu23.
it work well, and i must keep an eye of the output.
as i am trying this sed, it come to cross my mind that why,
instant of writing it on the same line?
at 1st i tried it and there are errors.
regards,
Helmi
Syntax of insert command
If you use single quotes you can use single backslash
The way anbu first posted the sed insert command allows $hdr_rec substitution, which is correct. Using single quotes would turn it off. Then line 1 would literally be:
I have a large dataset with following structure;
C 0001 Carbon
D SAR001 methane
D SAR002 ethane
D SAR003 propane
D SAR004 butane
D SAR005 pentane
C 0002 Hydrogen
C 0003 Nitrogen
C 0004 Oxygen
D SAR011 ozone
D SAR012 super oxide
C 0005 Sulphur
D SAR013... (3 Replies)
What I'm trying to accomplish. I receive a Header and Detail file for daily processing. The detail file comes first which holds data, the header is a receipt of the detail file and has the detail files record count. Before processing the detail file I would like to put a wrapper around another... (4 Replies)
Hi There!
I am saving the file count of all files in a directory to an output file using:
wc -l * > FileCount.txt
I get:
114 G4SXORD
3 G4SXORH
0 G4SXORP
117 total
But this count includes header and footer. I want to subtract 2 from the count and get
... (7 Replies)
I get this error when I try to compile following C program
#include <stdio.h>
#include <strings.h>
#define LEN 80
int main(void)
{
int mess, flag = 1;
int first = 0, last = 0;
printf("Enter a message: ");
gets(mess);
if (strlen(mess) > LEN)
... (3 Replies)
awk experts,
I have a big file of 4000 columns with header. Would like to print the columns with string value of "Commands" in header. File has "," separator. This file is on ESX host with Bash.
Thanks,
Arv (21 Replies)
Hi,
I'm having trouble pulling out columns where the headers match a file of key ID's I'm interested in and was looking for some help.
file1.txt
I
Name
34
56
84
350
790
1215
1919
7606
9420
file2.txt
I Name 1 1 2 2 3 3 ... 34 34... 56 56... 84 84... 350 350...
M 1 A A A A... (20 Replies)
i have .DAT file FILE1.DAT
1200910270040625
2123456789 J123456 ABC
2123456789 K123456 ABC
2222222222 L123456 DEF
2333333333 M12345 GHI
30000004
My outfile FILE2.TXT should have like this, I need the header value as ie (1200910270040625 ) body rows remove the duplicate rows and the... (2 Replies)
Dear all,
I have a file created in the name sample.txt in UNIX with header and footer. How to insert a required string (for example "FILE1") in the header part after the file has been created. What kind of command can i use to do the same.
Thanks in advance
Hari (3 Replies)
hi,
How to check a given file for a string and if it's not found, exit out ofthe script?
e.g. a file Test123 is there whose header begins with #bt and trailer begins with #ed.
I have to check if the header and trailer matches as above and if not, exit out of the script.
How can we do it in... (2 Replies)
I have a flat file and need to count no of records in the file less the header and the trailer record.
I would appreciate any and all asistance
Thanks
Hadi Lalani (2 Replies)