Implement in one line sed or awk having no delimiter and file size is huge
I have file which contains around 5000 lines.
The lines are fixed legth but having no delimiter.Each line line contains nearly 3000 characters.
I want to delete the lines
a> if it starts with 1 and if 576th postion is a digit i,e 0-9
or
b> if it starts with 0 or 9(i,e header and footer)
I want to redirect all the lines to another file which does not meet above criteria.
Following is the file named A.DAT where i have placed only one line otherwise it would be huge
I am using the following but it is giving error "sed: command garbled"
But if am running this command for a less no position like 57 instead of 575 ,it is working fine.
Can you pls someone tell me what is the issue here.And what would be the appropriate command using sed or awk.
Last edited by Franklin52; 01-20-2011 at 04:16 AM..
Reason: Please use code tags
I have 2 files; one file (say, details.txt) contains the details of employees and another file (say, emp.txt) has some selected employee names. I am extracting employee details from details.txt by using emp.txt and the corresponding code is:
while read line
do
emp_name=`echo $line`
grep -e... (7 Replies)
Hi Experts,
I had to edit (a particular value) in header line of a very huge file so for that i wanted to search & replace a particular value on a file which was of 24 GB in Size. I managed to do it but it took long time to complete. Can anyone please tell me how can we do it in a optimised... (7 Replies)
Dear All,
Good Evening!!
I have a requirement to ftp a 220GB backup file to a remote backup server.
I wrote a script for this purpose.
But it takes more than 8 hours to transfer this file.
Is there any other method to do it in less time???
Thanks in Advance!!!
---------- Post updated... (5 Replies)
I’m new to Linux script and not sure how to filter out bad records from huge flat files (over 1.3GB each). The delimiter is a semi colon “;”
Here is the sample of 5 lines in the file:
Name1;phone1;address1;city1;state1;zipcode1
Name2;phone2;address2;city2;state2;zipcode2;comment... (7 Replies)
Hi,
I have a file a.txt having no delimiter.
I want to exclude the line which contains 435th character as 1 or 2 and redirect the rest of the lines to another file b.
Can you pls suggest how to do this in one liner awk.
Following is just one line of the input file a:-
120110116 ... (10 Replies)
Hello ,
I'm trying to split a file which contains a single very long line.
My aim is to split this single line each 120 characters.
I tried with the sed command :
`cat ${MYPATH}/${FILE}|sed -e :a -e 's/^.\{1,120\}$/&\n/;ta' >{MYPATH}/${DEST}`
but when I wc -l the destination file it is... (2 Replies)
Hello,
I need to insert a line (like a header) as the first line of a very huge file (about 3 ml rows). I am able to do it with sed, but redirecting the output and creating a new file takes quite some time. I was wondering if there was a more efficient way of doing it?
Any help would be... (3 Replies)