![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Filter some text | Danish Shakil | Shell Programming and Scripting | 3 | 07-31-2008 05:58 AM |
| Remove duplicate text | dejavu88 | Shell Programming and Scripting | 7 | 06-08-2008 05:37 PM |
| Filter data from text file | b_sri | Windows & DOS: Issues & Discussions | 18 | 04-16-2008 11:41 AM |
| Deleting text block in file | andre123 | Shell Programming and Scripting | 1 | 02-27-2007 01:17 PM |
| using sed(?) to delete a block of text | toast | Shell Programming and Scripting | 3 | 10-23-2005 02:30 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Filter duplicate block of text using SED
Hi,
I would like to print a block of text between 2 regular expression using Sed, This can be achieved by using the command as shown below, however my problem is the same block of text is repeated twice. I would like to eliminate the duplicate block of text. For Example If my file test.txt contains following data. ********************************************** start test for the block test for the block test for the block End Blah Blah Blah Blah Blah Blah start test for the block test for the block test for the block end ******************* Now if i use sed command to print the text between regular expressions "start" and "end" sed -n '/start/,/end/p' text.txt >> ouput.txt I get the block of text twice in output.txt file as shown below ******************************************************************** start test for the block test for the block test for the block end start test for the block test for the block test for the block end **************** Please help on how do I filter duplicate printing. Thanks in Advance Deepak |
|
||||
|
I'd like to piggy-back onto this post and ask, how do I read everything in between "start" and "end" so that "start" and "end" are not included in the extraction?
I recognize that I can use different words, but I want to keep "start" and "end" in my file. The reason is that I created a help page for a script I wrote. When option -h is used, it grabs the text from the file. It would be handy to have all my help pages begin with "start" and end with "end". But I don't want those words to display on the screen. Thanks. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|