LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-10-2011, 05:57 AM   #1
cober
LQ Newbie
 
Registered: Feb 2009
Distribution: Debian 5.0
Posts: 14

Rep: Reputation: 0
Talking sed and rename text in file


I need a help with sed and renaming the text in file, so I'd be very pleased if anyone can help me with that.

Let's say we have this one:
Code:
Quote:
Originally Posted by nickname
nickname presents: $subject Size: size Click on the picture to view it in full size [img]www.blabla.com/img.jpg[/img] NFO: [nfo]RELEASE..: $release VIDEO....: $video DATE.....: $date FILES....: $files URL......: $url NOTES blablabla.[/nfo] This message has been hidden [nfo]*************************************************************************************** some text which i want to be removed ***************************************************************************************[/nfo]
First of all, I'd like to remove
Code:
quote tags.
Second, where is
Code:
[b]nickname presents: 
to

Code:
[b]cober presents: 
[nickname changed to cober]

Third, also want to be removed this line
Code:
url=link[img]www.blabla.com/img.jpg[/img]/url
and instead of that, I'd want to put my own link, as example
Code:
url=newlink[img]newlink[/img]/url
Fourth, there we have
Code:
[nfo]
and
Code:
[/nfo]
which are useless, so I'd need to remove that one like as up there.

And, finally we have something like:
Code:
This message has been hidden
 
[nfo]***************************************************************************************
 some text which i want to be removed  
***************************************************************************************[/nfo][/quote]
I'd like here to remove complete text.



I'd very appreciate any help related to this post, hope there is no much work, otherwise I can also pay someone to make this for me.

Thanks again!!!

Last edited by cober; 02-10-2011 at 06:02 AM.
 
Old 02-10-2011, 07:15 AM   #2
cober
LQ Newbie
 
Registered: Feb 2009
Distribution: Debian 5.0
Posts: 14

Original Poster
Rep: Reputation: 0
Hello,

Small update.

Can anyone tell me how to delete the last 4 lines from a file using a sed?
 
Old 02-10-2011, 03:30 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,986
Blog Entries: 11

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
Code:
sed -e :a -e '$d;N;2,4ba' -e 'P;D'
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for help with Bash script to search folders, rename, and output to text file ExitRitual Programming 8 01-05-2011 07:31 AM
using sed to replace text on one line in a text file vo1pwf Linux - Newbie 5 06-24-2009 07:54 AM
Rename 100+ files from a text file AGazzaz Linux - Software 9 09-26-2008 12:41 AM
help removing some text from a file (sed) BrianK Programming 2 08-13-2006 07:10 PM
SED - display text on specific line of text file 3saul Linux - Software 3 12-29-2005 04:32 PM


All times are GMT -5. The time now is 02:31 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration