Deleting first x lines of some files

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

Deleting first x lines of some files

Postby carlotursi » Tue Oct 04, 2005 2:08 pm

Hello,
I'm new to UltraEdit-32 and I have a problem with it.
I'll try to explain in the best possible way.

I have several text files (more than 4000); all these files have the same structure. I need to delete the first 12 lines of each of the 4000 files, and I would like to do this in an automatic way, but I don't know exactly how to do it...

I know that probably this is quite simple as a problem, but being new to this software I'm still learning to use it.

Can anyone help me?

Many thanks
Bye

Carlo Tursi
User avatar
carlotursi
Newbie
 
Posts: 4
Joined: Mon Oct 03, 2005 11:00 pm

Re: Deleting first x lines of some files

Postby Mofi » Wed Oct 05, 2005 5:07 am

If the 12 lines of all files are 100% identical and these 12 lines only exist once in all files, it's easy. Open one of these files, select the 12 lines and and open Search - Replace In Files. The selected text is automatically inserted in the find field. Now enter the directory and the file spezification search criteria and run the replace.
But first make a copy of the 4000 files, if you don't have experience.

If the 12 lines are not identical, give us some examples here in the forum inside [code][/code]. Use post preview button. Maybe we then can find a regular expression replace, which can work.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4039
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Deleting first x lines of some files

Postby carlotursi » Wed Oct 05, 2005 5:54 am

the 12 lines are not actually identical.
They are as follows:

Code: Select all
NOME FILE                 : A1A1
NUMERO DI CAMPIONI TOTALI :     6000
FREQUENZA DI CAMPIONAMENTO:      600
TEMPO DI ACQUISIZIONE     :     10.0
RANGE DI ACQUISIZIONE     :     10.0
CANALE DI INIZIO          :        1
CANALE DI TRIGGER         :        1
RANGE DI TRIGGER   %      :     20.0
RANGE DI TRIGGER IN VOLT  :      2.0
PRE/POST TRIGGER          :     10.0
NUMERO DI CANALI          :        6


What varies is the first line (A1A1 assumes different values in all 4000 files).

These lines are repeated once in each file.

Hope this helps.

Thanks
Bye
Carlo
User avatar
carlotursi
Newbie
 
Posts: 4
Joined: Mon Oct 03, 2005 11:00 pm

Re: Deleting first x lines of some files

Postby Mofi » Wed Oct 05, 2005 6:57 am

Try this "long" REGULAR EXPRESSION search string in the Replace In Files dialog. Replace it with nothing. Make sure Advanced - Configuration - Find - Unix style Regular Expressions is not checked, because this is a regular expression in UltraEdit style.

NOME FILE :*^pNUMERO DI CAMPIONI TOTALI :*^pFREQUENZA DI CAMPIONAMENTO:*^pTEMPO DI ACQUISIZIONE :*^pRANGE DI ACQUISIZIONE :*^pCANALE DI INIZIO :*^pCANALE DI TRIGGER :*^pRANGE DI TRIGGER % :*^pRANGE DI TRIGGER IN VOLT :*^pPRE/POST TRIGGER :*^pNUMERO DI CANALI :*^p
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4039
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Deleting first x lines of some files

Postby carlotursi » Wed Oct 05, 2005 4:35 pm

it worked fine.

Thanks a lot for the precious support.

Bye!

Carlo
User avatar
carlotursi
Newbie
 
Posts: 4
Joined: Mon Oct 03, 2005 11:00 pm


Return to Find/Replace/Regular Expressions

cron