text file processors

Author
Discussion

Otispunkmeyer

Original Poster:

12,593 posts

155 months

Tuesday 22nd July 2014
quotequote all
Not sure whether I should put this in the science thread but I'll try here first.

Is there a program for editing text files en-mass?

For example what I would really want to do is stuff a load of text files in a folder and have a program simply blast through them all removing the first 3 rows/lines from each file and then re-saving.

I have notepad ++ but I can't see that this will do what I want. I could write a program in SciLab, but I don't know how you deal with many different file names. I need something that will just pick the next file, regardless of what the name is, strip out the top 3 rows and save.

Any ideas?

lestag

4,614 posts

276 months

Tuesday 22nd July 2014
quotequote all
assuming windows 8 or access to powershell
google

powershell strip first line in files

mizx

1,570 posts

185 months

Tuesday 22nd July 2014
quotequote all
Could be done in Notepad++ using 'Find in files' with the right regex;

http://superuser.com/questions/310380/notepad-dele...

Edited by mizx on Tuesday 22 July 11:30

LordGrover

33,543 posts

212 months

Tuesday 22nd July 2014
quotequote all
Are the files equal length?
If on *nix either head or tail should do the trick.

illmonkey

18,199 posts

198 months

Tuesday 22nd July 2014
quotequote all
I have to do similar, I use TextCrawler, it basically is a find/replace for multiple files.

tribbles

3,974 posts

222 months

Tuesday 22nd July 2014
quotequote all
I'd use a Perl script to do it. But probably too much hassle for Windows.

Quick and dirty Windows solution would be VBScript.

lestag

4,614 posts

276 months

Tuesday 22nd July 2014
quotequote all
Here you go for powershell
http://britv8.com/remove-4-lines-from-the-start-of...
Tested on Windows 7

AlanQ

209 posts

284 months

Tuesday 22nd July 2014
quotequote all
Try this?
http://www.digitalvolcano.co.uk/textcrawler.html
A brilliant little program that's saved me hours on that kind of task

sorry just saw illmonkey said the same!

Otispunkmeyer

Original Poster:

12,593 posts

155 months

Tuesday 22nd July 2014
quotequote all
Cheers chaps

I shall give some of these a go.

BertB

1,101 posts

225 months

Tuesday 22nd July 2014
quotequote all
either TextCrawler or Vim (for windows).


Otispunkmeyer

Original Poster:

12,593 posts

155 months

Tuesday 22nd July 2014
quotequote all
Powershell works a treat. I wish I knew that existed sooner!!!

Mr E

21,616 posts

259 months

Tuesday 22nd July 2014
quotequote all
Why are we not using awk?

TheExcession

11,669 posts

250 months

Tuesday 22nd July 2014
quotequote all
Mr E said:
Why are we not using awk?
hehe

I've written/hacked some stupidly complex file parser scripts in awk before - thankfully I've forgotten it all now biggrin

lestag

4,614 posts

276 months

Tuesday 22nd July 2014
quotequote all
Otispunkmeyer said:
Powershell works a treat. I wish I knew that existed sooner!!!
thumbup
I've been on a 4 day powershell course this month, so of course EVERYTHING can be done with powershellbiggrin

TheExcession

11,669 posts

250 months

Tuesday 22nd July 2014
quotequote all
lestag said:
Otispunkmeyer said:
Powershell
thumbup
powershell
Powershell - Euphemism for Linux & awk? :clueless:

hehe

lestag

4,614 posts

276 months

Thursday 24th July 2014
quotequote all
TheExcession said:
owershell - Euphemism for Linux & awk? :clueless:

hehe
smile the scary thing is you can do regular expressions in it too... I hate them!frown

SlidingSideways

1,345 posts

232 months

Thursday 24th July 2014
quotequote all
lestag said:
smile the scary thing is you can do regular expressions in it too... I hate them!frown
Confucius says: Man with problem who thinks solution is regular expression now has two problems.

Mr E

21,616 posts

259 months

Thursday 24th July 2014
quotequote all
SlidingSideways said:
Confucius says: Man with problem who thinks solution is regular expression now has two problems.
s/two/many

lestag

4,614 posts

276 months

Thursday 24th July 2014
quotequote all
SlidingSideways said:
Confucius says: Man with problem who thinks solution is regular expression now has two problems.
That's why I skipped the section in the training biggrin I told the tutor I was skipping it because I would never use it. He said there may be a time when processing text that you would need it. I said you misunderstand me - I am *never* going to use it biggrin