Sponsored Content
Top Forums Shell Programming and Scripting sed: appending alternate line after previous line Post 302285936 by rish_max on Tuesday 10th of February 2009 01:52:04 AM
Old 02-10-2009
sed: appending alternate line after previous line

Hi all,
I have to append every alternate line after its previous line. For example if my file has following contents
line 1: unix is an OS
line 2: it is open source
line 3: it supports shell programming
line 4: we can write shell scripts

Required output should be
line1: unix is an OS it is open source
line 2: it supports shell programming we can write shell scripts

I think this could be done using sed, but how could i do this please help?
If it cant be done using sed then please suggest other methods
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Appending line/lines with sed

Hi folks, I need to append line or bulk of lines into a file. For example,I have the following section in opmn.xml file: <process-type id="OC4J_RTEadmin_NIR" module-id="OC4J"> <module-data> <category id="start-parameters"> <data... (28 Replies)
Discussion started by: nir_s
28 Replies

2. Shell Programming and Scripting

Sed - Appending a line with a variable on it

Hi, I searched the forum for this but couldn't find the answer. Basically I have a line of code I want to insert into a file using sed. The line of code is basically something like "address=1.1.1.1" where 1.1.1.1 is an IP Address that will vary depending on what the user enters. I'll just refer... (4 Replies)
Discussion started by: eltinator
4 Replies

3. Shell Programming and Scripting

Merging previous line using sed

I've been trying to merge a previous line when I find a pattern using sed with no luck. Maybe someone can help me. I am trying to find </Endtag>. Once I find that, I want to merge the previous line with the current line. I can do it with the next line with using N in sed but not previous.... (6 Replies)
Discussion started by: quixoticking11
6 Replies

4. Shell Programming and Scripting

Print previous, current and next line using sed

Hi, how can i print the previous, current and next line using sed? current line is the matching line. The following prints all lines containing 'Failure' and also the immediate next line cat $file | sed -n -e '/Failure/{N;p;}' Now, i also want to print the previous line too. Thanks,... (8 Replies)
Discussion started by: ysrinu
8 Replies

5. Shell Programming and Scripting

SED or AWK "append line to the previous line"

Hi, How can I remove the line beak in the following case if the line begin with the special char “;”? TEXT Text;text ;text Text;text;text I want to convert the text to: Text;text;text Text;text;text I have already tried to use... (31 Replies)
Discussion started by: research3
31 Replies

6. Shell Programming and Scripting

awk;sed appending line to previous line....

I know this has been asked before but I just can't parse the syntax as explained. I have a set of files that has user information spread out over two lines that I wish to merge into one: User1NameLast User1NameFirst User1Address E-Mail:User1email User2NameLast User2NameFirst User2Address... (11 Replies)
Discussion started by: walkerwheeler
11 Replies

7. Shell Programming and Scripting

Sed: Working on a line Previous to a pattern.

Hello everyone, I am working with some train time tables, and i have hit a bit of a road block. Using grep/sed i have done a reasonable job of parsing the html into comma delimited format, but NJ transit prints The Track number and status on a new line, and I would much prefer it all on a... (6 Replies)
Discussion started by: mussen
6 Replies

8. Shell Programming and Scripting

Inserting a line in a file after every alternate line

Friends , I have a large file and i need to insert a line after every line.I am actually unaware how to do it.Any help appreciated. My File control station *ATM* , qread $OSS.Jul13A.FI01 interval 1 intcount 1 control station *ATM* , qread $OSS.Jul13A.FI02 interval 1 intcount... (4 Replies)
Discussion started by: appu2176
4 Replies

9. Shell Programming and Scripting

Sed Comparing Parenthesized Values In Previous Line To Current Line

I am trying to delete lines in archived Apache httpd logs Each line has the pattern: <ip-address> - - <date-time> <document-request-URL> <http-response> <size-of-req'd-doc> <referring-document-URL> This pattern is shown in the example of 6 lines from the log in the code box below. These 6... (1 Reply)
Discussion started by: Proteomist
1 Replies

10. Shell Programming and Scripting

sed for appending a line before a pattern and after another patter.

Hi All, I'm appending a line before a pattern and after another pattern(;) but omitting the first pattern - same as if comes duplicates before the second pattern. Also, I'm adding a word before the first pattern - Here is my file select blah blah hello select blah blah ; select... (6 Replies)
Discussion started by: Mannu2525
6 Replies
yppasswdd(4)							   File Formats 						      yppasswdd(4)

NAME
yppasswdd - configuration file for rpc.yppasswdd (NIS password daemon) SYNOPSIS
/etc/default/yppasswdd DESCRIPTION
The yppasswdd file contains a parameter that modifies the behavior of the rpc.yppasswdd(1M) daemon. The yppasswdd file contains a single parameter: #check_restricted_shell_name=1 By default in the current release, this line in yppasswdd is commented out. If you uncomment the line, when a user attempts to change his default shell using `passwd -r nis -e` (see passwd(1)), the rpc.yppasswdd daemon checks whether the name of the user's current shell begins with an 'r'. rpc.yppasswdd considers any shell whose name begins with an 'r' (for example, rcsh) to be a restricted shell. If a user's shell does begin with 'r', his attempt to change from the default shell will fail. If the line in the yppasswdd file is commented out (the default), the rpc.yppasswdd daemon does not perform the restricted shell check. The yppasswdd file is editable only by root or a member of the sys group. FILES
/etc/default/yppasswdd configuration file for rpc.yppasswdd daemon SEE ALSO
rpc.yppasswdd(1M) SunOS 5.11 8 Nov 2001 yppasswdd(4)
All times are GMT -4. The time now is 11:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy