I want to remove the first 6 characters of every second line. This means in lines that do not start with "@HWUSI" or only contains "+".
I have made the following shell script (trim.sh), but it runs very very slow (>than 12 hours for a file with 8,000,000 lines; I have not been patient to run it more than 12 hours).
Can anyone come up with a suggestion to make it run faster or have I made it in a way, so that it will run for eternity?
Hope for some help. Thanks.
Last edited by Scott; 06-06-2010 at 07:48 AM..
Reason: Code tags, please...
And, if you have mawk available on your platform, give it a try. It's lightning fast! Just did a test on a 1 million line test file:
awk 10 sec.
mawk 0,3 sec.
here's what im trying to do.
i have a file containing lines similar to this:
data.txt:
1hsRmRsbHRiSFZNTTA1dlEyMWFkbU5wUW5CSlIyeDFTVU5SYjJOSFRuWmpia0ZuWXpKV2FHTnRU
1lKUnpWMldrZFZaMG95V25oYQpSelEyWTBka2QyRklhSHBrUjA1b1kwUkJkd3BOVXpWM1lVaG5k... (5 Replies)
I have a test file with the following format, It contains the username_date when the user was locked from the database.
$ cat lockedusers.txt
TEST1_21062016
TEST2_02122015
TEST3_01032016
TEST4_01042016
I'm writing a ksh script and faced with this difficult scenario for my... (11 Replies)
hi Gurus,
I need separate a file which is one huge line to multiple lines based on certain number of charactors. for example:
abcdefghi high abaddffdd
I want to separate the line to multiple lines for every 4 charactors.
the result should be
abcd
efgh
i hi
gh a
badd
ffdd
Thanks in... (5 Replies)
I want to delete all the blank lines from a file before a certain line number. e.g.
Input file (n: denotes line number)
1: a
2:
3: b
4: c
5:
6: d
I want to delete all blank lines before line number 3, such that my output is:
a
b
c
d
I see that sed '/^$/d' in_file works... (9 Replies)
How can I specify special meaning characters like ^ or $ inside a regex range. e.g
Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character.
I tried the following but it does not work:
sed 's/\(\)/<do something here>/g' file1
... (3 Replies)
to delete the duplicate characters in a file I used this code
cat file.txt|tr -s ""
tell the other ways using sed
command to count of duplicate characters
thanks:) (0 Replies)
I have a file with varying record length in it. I need to reformat this file so that each line will have a length of 100 characters (99 characters + the line feed).
AU * A01 EXPENSE 6990370000 CWF SUBC TRAVEL & MISC
MY * A02 RESALE 6990788000 Y... (3 Replies)
Dear All,
I am looking for an option in perl using which i could delete empty lines in a file.
Or
the alternative of sed '/^$/d' <filename> in perl. Sed is not working in my perl script :(
Pls help me out .
Thanks,
VG (4 Replies)
Hi all,
I know the one liner to delete all the lines in a file which matches a pattern
i.e
perl -i.old -ne 'print unless /pattern/' file
Now i need the perl onliner to delete all the lines which doesnt match the pattern. Also what is the difference between perl -i and perl -i.old.
Does... (1 Reply)