Sponsored Content
Top Forums Shell Programming and Scripting SED - adding a new line after pattern Post 302211716 by eagercyber on Friday 4th of July 2008 05:22:49 AM
Old 07-04-2008
Thanks a lot for your help.

My original file looks like

Name: Eager
DOB: 19-Apr-1981
Address: 2nd Cross, Church Street
Contact: 407 ...
Qualification: Bachelor Of Comp Science

Needs to become

Name: Eager
DOB: 19-Apr-1981
DOJ: 20-Jun-2005
Address: 2nd Cross, Church Street
Contact: 407 ...
Qualification: Bachelor Of Comp Science

I have a file like DOJAdd.txt which mentiones Eager.txt which needs to be altered

DOJAdd would look like

Eager: 20-Jun-2005
Seeker: 18-Sep-2007

So I am extracting 20-Jun-2005 for Eager file and adding that content
 

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
HTML::FormFu::Deflator::CompoundSplit(3pm)		User Contributed Perl Documentation		HTML::FormFu::Deflator::CompoundSplit(3pm)

NAME
HTML::FormFu::Deflator::CompoundSplit - CompoundSplit deflator SYNOPSIS
--- element: - type: Multi name: address elements: - name: number - name: street deflator: - type: CompoundSplit # set the default $form->get_field('address')->default( $address ); DESCRIPTION
Deflator to allow you to set several field's values at once. For use with a HTML::FormFu::Element::Multi group of fields. A default value passed to the Multi field will be split according to the "split" setting, and its resulting parts passed to its child elements. METHODS
split Arguments: $regex Default Value: "qr/ +/" Regex used to split the default value. Defaults to a regex matching 1 or more space characters. join Arguments: $string Default Value: ' ' If spliting the value results in more parts than there are fields, any extra parts are joined again to form the value for the last field. The value of "join" is used to join these values. Defaults to a single space. For example, if the Multi element contains fields "number" and "name", and is given the value "10 Downing Street"; when split this results in 3 parts: 10, "Downing" and "Street". In this case, the 1st part, 10 is assigned to the first field, and the 2nd and 3rd parts are re- joined with a space to give the single value "Downing Street", which is assigned to the 2nd field. field_order Arguments: @order If the parts from the split value should be assigned to the fields in a different order, you must provide an arrayref containing the names, in the order they should be assigned to. --- element: - type: Multi name: address elements: - name: street - name: number deflator: - type: CompoundSplit field_order: - number - street AUTHOR
Carl Franks LICENSE
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-01-23 HTML::FormFu::Deflator::CompoundSplit(3pm)
All times are GMT -4. The time now is 06:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy