Saving time ?
Good to be back, long time without post here !
Damn day, I have 30 000 thousands text files and I need quickly to change some informations contained in the files. In fact I have to update some dates in these files....
Some time it's longer to think about about to do it a clever way than doing by brute force !
Option one : if I was a windows user I would open file by file, I would use MS word for this and then use the replace function, type each time the text to find and to replace
Option two : back home, log on linux and in two minutes refresh my sed basic knowledge a make a script
Option three : why not having more fun with sed and vim ??? Why? Because vi is rigolo !!
Here is the Option 3 :
for i in *.txt; do vim -c '%s/08\/02\/07/22\/02\/07/g' -c 'wq!' $i; done
Done !
Damn day, I have 30 000 thousands text files and I need quickly to change some informations contained in the files. In fact I have to update some dates in these files....
Some time it's longer to think about about to do it a clever way than doing by brute force !
Option one : if I was a windows user I would open file by file, I would use MS word for this and then use the replace function, type each time the text to find and to replace
Option two : back home, log on linux and in two minutes refresh my sed basic knowledge a make a script
Option three : why not having more fun with sed and vim ??? Why? Because vi is rigolo !!
Here is the Option 3 :
for i in *.txt; do vim -c '%s/08\/02\/07/22\/02\/07/g' -c 'wq!' $i; done
Done !
1 Comments:
That's right!! Vi is rigolo!!
Good to see you back... I also need to kick my butt and post here.
Post a Comment
<< Home