shanenin Posted May 16, 2005 Report Share Posted May 16, 2005 (edited) I have a text file, I would like to edit. I am sure there must be an easy command to do it. Below is the contents of an example file called movielist.txtincredibles.mp4incredibles.mp4.confitalian-job.mp4italian-job.mp4.confjersey-girl.mp4jersey-girl.mp4.confjungle-book-2.mp4jungle-book.mp4jungle-book.mp4.confkillbill-vol2.mp4killbill-vol2.mp4.confkillbillvol1.mp4killbillvol1.mp4.confI want to remove all lines that end with ".conf" I am trying to make a list that contains only movie files(.mp4) Edited May 16, 2005 by shanenin Quote Link to post Share on other sites
shanenin Posted May 16, 2005 Author Report Share Posted May 16, 2005 (edited) this line seems to work sed '/.conf/d' movielist.txt > movielist2.txtIs there a way to do it without having to create a new file, by directly changing the original file? Edited May 16, 2005 by shanenin Quote Link to post Share on other sites
jcl Posted May 16, 2005 Report Share Posted May 16, 2005 sed's -i option enables in-place editing, with optional backups. Quote Link to post Share on other sites
shanenin Posted May 16, 2005 Author Report Share Posted May 16, 2005 (edited) that works nice :-)edit added later//I friend wanted a list of all of my movies on my harddrive. Here is the final command i ended up usingls freevo/{movies,movies2} | sed -n '/\.mp4/p' > movielist.txtthat is like my 20th revisison ;-)edit added later//actaully I needed on more revision, the command above was also copying my movie.mp4.conf files that mplayer uses. I need to add a $ls freevo/{movies,movies2} | sed -n '/\.mp4$/p' > movielist.txt Edited May 16, 2005 by shanenin Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.