Quote:
Originally Posted by dinesh1985
input file
First Name - position from 1-5
Last Name- position 6-10
Age-Position 11-12
Say above is the format of input file.
Example:
DINESKUMAR21
SACHISHAH 23
23
GURUNTARIM22
In the above example,in the 3 rd record Name is missing. Now while reading the file line by line,I want to delete the 3 rd line during validation.
---------- Post updated at 08:47 AM ---------- Previous update was at 08:46 AM ----------
for the third line blankspaces will be present before 23
|
Hi,
You can use the below command to delete the invalid line.
cat data | awk '{ if(substr($1,1,5)!="" && substr($1,6,10)!="" && substr($1,11,12)!="") print $1}' > new_filtered_file_name.
Where the data is the input file.
Thanks,
chidhu