Scrutinizer,
I think the OP is saying the input file has lines with 4 fields using <tab> as a separator and some fields are empty. Unfortunately, when IFS is set to <tab> (or <space>) groups of <tab>s (or <space>s and <tab>s) are treated as a single field separator. I don't believe that this behavior for IFS set to a single <tab> character conforms to the standards, but since this seems to be existing practice in both bash and ksh, this may be considered a bug in the standard.
benalt,
If I understand what you're trying to do, the following should work with ksh (or any shell that performs the parameter expansions required by the POSIX standards):
(where the whitespace in % * and in * } is a single literal <tab> character in all of the above parameter expansions.
If file.txt contains:
the output produced is:
This User Gave Thanks to Don Cragun For This Post:
Hello
I have a file like this...
Name |Sex|Security-Number
abx |F |33787728
cdr |M |823483993
derf |F |
i would like to use awk to delete all records from the file that has a blank in the the 3 rd feild .
the output should be like
... (1 Reply)
Hi,
I have the following data in the format as shown (note: there are more than 1 blank spaces between each field and the spaces are not uniform, meaning there can be one blank space between field1 and field2 and 3 spaces between field3 and field4, in this example, # are the spaces in between... (19 Replies)
I want to exclude (-v) blank records from a file before analysing it.
I know I can use '^]$' for spaces and tabs but how do you look for lines that have nothing (/n or line feed) ? (2 Replies)
I have a file with the following values:
File name à a.log (bulk file with 100+ lines with the similar format)
aaaa|bbbb|cccc|dddd|eeee|ffff|gggg|hhhh|iiii|
aaaa|bbbb|cccc|dddd|eeee|ffff|gggg|hhhh|iiii|
aaaa|bbbb|cccc|dddd|eeee|ffff|gggg|hhhh|iiii|... (3 Replies)
Hi Friends,
I have large volume of data file as shown below.
Beganing or end of each filed, there are some blank spaces.
How do I remove those spaces?
AAA AAA1 | BBB BB1 BB2 |CC CCCC
DDDD DD | EEEEEEE EEEEEEEE | FFF FFFFFF FFFF
GG GGGGGG |HH HH ... (3 Replies)
Hello All,
I am trying a one liner for finding the number of null columns in every line of my flat file.
The format of my flat file is like this
a|b|c|d||||e|f|g|
a|b|c|d||||e|f|g|
I want to count the number of fields delimited by "|" which are blank.
In above case the count should be... (6 Replies)
Hi All
I would like to modify a file like this:
>antax gioq21 tris notes
abcdefghij
klmnopqrs
>betax gion32 ter notes2
tuvzabcdef
ahgskslsooin this:
>tris
abcdefghij
klmnopqrs
>ter
tuvzabcdef
ahgskslsoo
So, I would like to remove the first two fields(and output field 3) in record... (4 Replies)
Hi All
Need Help
I have a file with the below format (ABC.TXT) :
®¿¿ABCDHEJJSJJ|XCBJSKK01|M|7348974982790
HDFLJDKJSKJ|KJALKSD02|M|7378439274898
KJHSAJKHHJJ|LJDSAJKK03|F|9898982039999
(cont......)
I need to write a script where it will check for : blank lines (between rows,before... (6 Replies)
I have a file with the following format:
X|High|2|GIC|DM||XHM|||6 Months
X|Moderate|2|GIC|DM||XHM|||6 Months
X|High|2|GCM|DM||XSF|||6 Months
X|Med|2|GCM|DM||XSF|||6
Here there are ten columns but I need to print rows having blank records in any of the rows (except for 6th,8th and 9th... (10 Replies)
The below code works great, kindly provided by @Don Cragun, the lines in bold print the current output. Since some of the fields printed can be blank some of the fields are shifted. I can not seem too add . to the blank fields like in the desired output. Basically, if there is nothing in the field... (10 Replies)