You could also consider something like:
Or, if you'd like to use the variables read from the 1st line while processing remaining lines in your input file:
If parentfile contains the text shown in post #1 in this thread:
This last script will produce firstfile containing:
and secondfile containing:
Note that there is an unwanted space before the email address in secondfile because there is a space after the field separator (a comma) in the first line of your sample input file that becomes part of the value assigned to var2.
Although this these scripts were written and tested using a Korn shell, both of these will work with any shell that uses standard POSIX shell command language syntax.
Hi,
In a script I have to check that input text files with a variable number of tab delimited fields have at least n fields and no more than m fields. Records are delimited by <CR> and <LF>.
I have figured out code that will strip out all the alpha-numeric characters, convert the tabs to... (3 Replies)
Hi,
I'm trying this command - but get this error.
Do you guys have any workaround for this?
cat tf|sed 's/{//g'|sed 's/,//g'|awk '{for (i=1;i<=NF;i++) {if ($i == "OPTIME") {k = i + 2; print $i,$k}}}'
awk: record `2005 Jul 28 17:35:29...' has too many fields
record number 15
This is how... (3 Replies)
Hi all,
I have an input file with no delimiter. Let us say the file is abc.txt having values for fields namely, EmpNumEnameDesigSalDept. Ofcourse the file has got several records. Every field has got a fixed start and end position.
I need to assign the fields to corresponding varibles say... (1 Reply)
I was wondering if there was a way to modify a tab delimited text file, up to 185,000 lines long by adding a repeated field to a block of 20 data , then repeat the process until the file is processed.
The current file looks like: ... (3 Replies)
Dear All ,
I have the query
cat temp.txt
|28-07-1997|IF_LEG_DCCT|TOV JV sdfsdfdsfdsfdsCLOSED* KIEV|381015280
I need to count the number of fields in this pipe-seperated file. I beleive this is possible via AWK command.
The in above file, output of the count should be 5....
Can some-one... (5 Replies)
:confused:
Hi Friends,
In the record below i have to make changes in the fields by putting the values stored in the temporary variables, x, y, z, p, q, r:
2) In the TBT record store the values in the various fields as:
a) X in a field position 51 to 56
b) Y... (5 Replies)
Hi,
i want to generate print statement using awk.
i have 20+ and 30+ fields in each line
Now its priting only first eight fields print statement as output not all.
my record is as shown below filename
... (2 Replies)
I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)