Sponsored Content
Top Forums Shell Programming and Scripting SED - adding a new line after pattern Post 302211686 by zaxxon on Friday 4th of July 2008 05:06:47 AM
Old 07-04-2008
Better show a larger snippet of your input file to make circumstances easier to see/understand, please.

Code:
PAT="DOJ:20-Jun-2005"
sed '/^DOB.*$/a\'${PAT}'' infile

Will now only add that pattern as a separate line if, if the former line starts with DOB.
 

10 More Discussions You Might Find Interesting

1. Solaris

adding a new line using sed command

I need to find text "A" and replace it with A B. The issue is that I need a new line between A and B. \n does not do the work. Any help would be much appreciated. Thanks, (2 Replies)
Discussion started by: ivesia
2 Replies

2. UNIX for Dummies Questions & Answers

sed - adding new line

I want to use sed to look for spaces in text and when find one move the next word to the next line. I used: sed 's/ /\n/g' out > new However when there is more than one space between two words it adds more lines between them. And I just want the words to be one under another. How can I... (2 Replies)
Discussion started by: sovixi
2 Replies

3. Shell Programming and Scripting

Need help in sed command (adding a blank line btw each block generated by pattern)

Hello friends, I have a C source code containing sql statements. I use the following sed command to print all the sql blocks in the source code.... sed -n "/exec sql/,/;/p" Sample.cpp The above sed command will print the sql blocks based on the pattern "exec sql" & ";"... (2 Replies)
Discussion started by: frozensmilz
2 Replies

4. Shell Programming and Scripting

sed: Find start of pattern and extract text to end of line, including the pattern

This is my first post, please be nice. I have tried to google and read different tutorials. The task at hand is: Input file input.txt (example) abc123defhij-E-1234jslo 456ujs-W-abXjklp From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Discussion started by: TestTomas
5 Replies

5. Shell Programming and Scripting

sed adding a blank line

I use the following as part of a script to correct for a faulty hostname file. # get the domain name read -r thehostname < /etc/hostname dom="$(echo $thehostname | cut -d'.' -f2)" numchar=${#dom} if then echo "It appears as though the hostname is not correctly set." echo "Hostname has... (5 Replies)
Discussion started by: bugeye
5 Replies

6. UNIX for Dummies Questions & Answers

Sed: Adding new line after matching pattern

Hi I just wanted to add a new line after every matching pattern: The method doing this doesn't matter, however, I have been using sed and this is what I tried doing, knowing that I am a bit off: sed 'Wf a\'/n'/g' Basically, I want to add a new line after occurrence of Wf. After the line Wf... (5 Replies)
Discussion started by: MIA651
5 Replies

7. Shell Programming and Scripting

sed adding a new line not working

The file which is used is /abc/apps/cobbbbbb/apps/abadv/binder/axyz.bnd /abc/apps/cobbbbbb/apps/abbrio/binder/na6115.bnd /abc/apps/cobbbbbb/apps/abbrio/binder/kc22.bnd /abc/apps/cobbbbbb/apps/abbrio/binder/tr4823.bnd /abc/apps/cobbbbbb/apps/abcmp/binder/cpc0105.bnd The commads which I ran... (3 Replies)
Discussion started by: bhavanabahety
3 Replies

8. Shell Programming and Scripting

sed adding a new line not working

sed '/patternstring/ a\ new line string' file1 The above code is not working even with the i option.... it shows sed grambled if '\' after new line string is not being used....after using no changes it is displaying..Pls help (5 Replies)
Discussion started by: bhavanabahety
5 Replies

9. Shell Programming and Scripting

Sed: printing lines AFTER pattern matching EXCLUDING the line containing the pattern

'Hi I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match. Which option is to be used to exclude the line containing the pattern? sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies

10. UNIX for Beginners Questions & Answers

Adding a new line after a specific line with sed

Hi All, My requirement is to add a specific line in a file after a certain line that contains 'setenv' the existing code is like setenv SEQFILES "/ConvWrk/inteng03/alltars/bnymais1" LIBDEF scope='JOB' type='PGM' dataset='SUNAR.PJ90000P.JOBLIB'... (5 Replies)
Discussion started by: gotamp
5 Replies
ESMERGE(1)							   User Commands							ESMERGE(1)

NAME
esmerge - merge audio and video ES into a TS DESCRIPTION
Usage: esmerge [switches] <video-file> <audio-file> <output-file> TS tools version 1.11, esmerge built Nov 11 2008 17:15:46 Merge the contents of two Elementary Stream (ES) files, one containing video data, and the other audio, to produce an output file containing Transport Stream (TS). Files: <video-file> is the ES file containing video. <audio-file> is the ES file containing audio. <output-file> is the resultant TS file. Switches: -quiet, -q Only output error messages. -verbose, -v Output information about each audio/video frame. -x Output diagnostic information. -h264 The video stream is H.264 (the default) -avs The video stream is AVS -vidrate <hz> Video frame rate in Hz - defaults to 25Hz. -rate <hz> Audio sample rate in Hertz - defaults to 44100, i.e., 44.1KHz. -cd Equivalent to -rate 44100 (CD rate), the default. -dat Equivalent to -rate 48000 (DAT rate). -adts The audio stream is ADTS (the default) -l2 The audio stream is MPEG layer 2 audio -mp2adts The audio stream is MPEG-2 style ADTS regardless of ID bit -mp4adts The audio stream is MPEG-4 style ADTS regardless of ID bit -ac3 The audio stream is Dolby AC-3 in ATSC -patpmtfreq <f> PAT and PMT will be inserted every <f> video frames. by default, f = 0 and PAT/PMT are inserted only at the start of the output stream. Limitations =========== For the moment, the video input must be H.264 or AVS, and the audio input ADTS, AC-3 ATSC or MPEG layer 2. Also, the audio is assumed to have a constant number of samples per frame. esmerge <video-file> <audio-file> <output-file> TS tools version 1.11, esmerge built Nov 11 2008 17:15:46 Merge the contents of two Elementary Stream (ES) files, one containing video data, and the other audio, to produce an output file containing Transport Stream (TS). Files: <video-file> is the ES file containing video. <audio-file> is the ES file containing audio. <output-file> is the resultant TS file. Switches: -quiet, -q Only output error messages. -verbose, -v Output information about each audio/video frame. -x Output diagnostic information. -h264 The video stream is H.264 (the default) -avs The video stream is AVS -vidrate <hz> Video frame rate in Hz - defaults to 25Hz. -rate <hz> Audio sample rate in Hertz - defaults to 44100, i.e., 44.1KHz. -cd Equivalent to -rate 44100 (CD rate), the default. -dat Equivalent to -rate 48000 (DAT rate). -adts The audio stream is ADTS (the default) -l2 The audio stream is MPEG layer 2 audio -mp2adts The audio stream is MPEG-2 style ADTS regardless of ID bit -mp4adts The audio stream is MPEG-4 style ADTS regardless of ID bit -ac3 The audio stream is Dolby AC-3 in ATSC -patpmtfreq <f> PAT and PMT will be inserted every <f> video frames. by default, f = 0 and PAT/PMT are inserted only at the start of the output stream. Limitations =========== For the moment, the video input must be H.264 or AVS, and the audio input ADTS, AC-3 ATSC or MPEG layer 2. Also, the audio is assumed to have a constant number of samples per frame. SEE ALSO
The full documentation for esmerge is maintained as a Texinfo manual. If the info and esmerge programs are properly installed at your site, the command info esmerge should give you access to the complete manual. esmerge 1.11 November 2008 ESMERGE(1)
All times are GMT -4. The time now is 07:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy