Deleting 1st 20 (or so) columns and adding text

Find, replace, find in files, replace in files, regular expressions

Deleting 1st 20 (or so) columns and adding text

Postby missing_cipher » Sun Sep 07, 2008 2:35 pm

Sorry, I didn't know how to name the topic.

But, basically, what I have is:

Code: Select all
2008-09-05-23:00,534,2012387975
2008-09-05-23:00,534,2012866888
2008-09-05-23:00,534,2012894626
2008-09-05-23:00,534,2013045974
2008-09-05-23:00,534,2013048601
2008-09-05-23:00,534,2013049556
2008-09-05-23:00,534,2013123625
2008-09-05-23:00,534,2014285243
2008-09-05-23:00,534,2014285467
2008-09-05-23:00,534,2014673009

And I need it to be:

Code: Select all
xxxxx+2012387975
xxxxx+2012866888
xxxxx+2012894626
xxxxx+2013045974
xxxxx+2013048601
xxxxx+2013049556
xxxxx+2013123625
xxxxx+2014285243
xxxxx+2014285467
xxxxx+2014673009

I work with a lot of files at a time, so maybe a script is better? I don't know.

My manual procedure now is selecting the first 20 rows, deleting them and then Searching for '^p' and replacing with 'xxxxx+'.

How can I automate my task?

Cheers.
missing_cipher
Newbie
 
Posts: 2
Joined: Sun Sep 07, 2008 2:28 pm

Re: Deleting 1st 20 (or so) columns and adding text

Postby pietzcker » Mon Sep 08, 2008 1:30 am

Activate Perl regular expressions (check the readme topic of this forum for instructions).
Then search for

^.{20}

and "replace all" with

xxxxx+

HTH,
Tim
User avatar
pietzcker
Master
Master
 
Posts: 241
Joined: Sun Aug 22, 2004 11:00 pm

Re: Deleting 1st 20 (or so) columns and adding text

Postby missing_cipher » Wed Sep 10, 2008 4:15 pm

Thanks a lot, man. You saved me hours of work. :D

Cheers!
missing_cipher
Newbie
 
Posts: 2
Joined: Sun Sep 07, 2008 2:28 pm


Return to Find/Replace/Regular Expressions