Sponsored Content
Full Discussion: join 2 lines
Top Forums Shell Programming and Scripting join 2 lines Post 302400143 by dennis.jacob on Tuesday 2nd of March 2010 09:58:13 AM
Old 03-02-2010
Quote:
Originally Posted by danmero
alister your solution will work only for the first occurrence.
dennis.jacob your solution will work only on next line.
Try on this data sample:
Code:
/dev/xxx oracle test
/dev/sap
9999 000 88 99
/dev/xxx oracle test
/dev/sap
9999 000 88 99
9999 000 88 99

danmero, I did not get you. I think the output which I am getting for the sample data is correct as per my understanding.


Code:
/home/usr1 >awk ' _s { print _s,$0; _s="";next; }NF==1 { _s=$0; }!_s' < file
/dev/xxx oracle test
/dev/sap 9999 000 88 99
/dev/xxx oracle test
/dev/sap 9999 000 88 99
9999 000 88 99
/home/usr1 >cat file
/dev/xxx oracle test
/dev/sap
9999 000 88 99
/dev/xxx oracle test
/dev/sap
9999 000 88 99
9999 000 88 99

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

join two lines together

Hi, I have a file with on one line a uid, and on the next line a date. I am trying to make the to into one line. Here's an example: koppx 20031125 kraan 20031119 sarox 20031107 And this is what i want it to be: koppx;20031125 kraan;20031119 sarox;20031107 I have been trying... (4 Replies)
Discussion started by: tine
4 Replies

2. Shell Programming and Scripting

Join Every 5 Lines With $ Symbol

Hi All, I have output like this in one file. IFName: aust00m1.mis.amat.com ] ObjID: 5eceea48-0d59-71dd-1512-9887a1f10000 IFAlias: Dest: AMNA austkchr1-ser0/0/0:0.315 Type: FRASI CID: DHEC.559128 IFDescription: ATM9/1/0.315-atm subif Status: Normal IFName: aust00m1.mis.amat.com ] ObjID:... (3 Replies)
Discussion started by: ntgobinath
3 Replies

3. UNIX for Dummies Questions & Answers

how to join lines

can anyone tell me as "how to join all lines in a file " using a shell script Actually i have many files in a directory and for each file i want to join all the lines using a shell scrip . Thanks in advance!!! (8 Replies)
Discussion started by: glamo_2312
8 Replies

4. Shell Programming and Scripting

join lines

input1 x x input2 y x x z join input1 input2>>output ouput x x (2 Replies)
Discussion started by: repinementer
2 Replies

5. Shell Programming and Scripting

Join the lines

Hi All, Currently, the output looks like this: hdisk0 queue_depth:3 hdisk1 queue_depth:3 hdisk2 queue_depth:1 hdisk3 queue_depth:1 I need to change the format to look like this: hdisk0 queue_depth:3 hdisk1 queue_depth:3 hdisk2 queue_depth:1 (8 Replies)
Discussion started by: Beginer0705
8 Replies

6. Shell Programming and Scripting

join two lines

I want to join this two lines but only when after him I have nothing or a comma Yes, I know Jonesy, and I'll give him about one more minute. this two lines must become Yes, I know Jonesy, and I'll give him about one more minute. thank you very much (11 Replies)
Discussion started by: thailand
11 Replies

7. Shell Programming and Scripting

join lines in file

I have a file like this: --------------------------------------------------------------- 26 00:04:48,440 --> 00:04:51,440 I don't know why he can't just do the Great Apache Flaming Arrow Act. 27 00:04:52,440 --> 00:04:54,839 Didn't you tell him to use the gopher snake? 28... (1 Reply)
Discussion started by: thailand
1 Replies

8. Shell Programming and Scripting

Join multiple lines

Hi I have a source file ( written i C ) where a funtion call is spread over multiple lines, for example : func( a, b, c ); I want this to be joined into one single line : func(a,b,c); How can this be done with awk and sed ? Regards. Hench (2 Replies)
Discussion started by: hench
2 Replies

9. UNIX for Dummies Questions & Answers

Join lines in a file????

Hello UNIX gurus, I am new to the world of UNIX. Hopefully I am submitting my question at the right forum. Here is my dilemma - I have a file with contents like this - "line1","Hello","World","Today is a wonderful day","yes it is" "line2","Hello","World","Today is a beautiful day","oh... (8 Replies)
Discussion started by: foolishbar
8 Replies

10. Shell Programming and Scripting

Join Lines

Hi how do I join files like below in script. Thanks, Ashan there are may line like this in the file. zone name DR_TMP_A_sev1_3eA vsan 200 pwwn 50:00:09:73:f0:16:35:08 pwwn c0:50:76:08:6e:dc:00:16 zone name DR_TMP_A_SVR2_3eA vsan 200 pwwn 50:00:09:73:f0:16:35:08 pwwn... (4 Replies)
Discussion started by: ashanabey
4 Replies
SCREENBLANK(1)						    BSD General Commands Manual 					    SCREENBLANK(1)

NAME
screenblank -- screen saver daemon for wscons and FBIO machines SYNOPSIS
screenblank [-k | -m] [-d inactivity-timeout] [-e wakeup-delay] [-f framebuffer] [-i input-device] screenblank {-b | -u} DESCRIPTION
screenblank disables the framebuffer if the keyboard and mouse are idle for a period of time, and re-enables the framebuffer when keyboard or mouse activity resumes. When killed with a SIGINT, SIGHUP, or SIGTERM, screenblank will re-enable the framebuffer. The pid can be found in the file /var/run/screenblank.pid. The options are as follows: -b Overriding the other options, simply try (once) to blank the framebuffer, then exit. -d inactivity-timeout Wait the number of seconds specified by inactivity-timeout, expressed in the format ``xxx.xxx'', before disabling the framebuffer due to inactivity. The default is 600 seconds (10 minutes). -e wakeup-delay Wait the number of seconds specified by wakeup-delay, expressed in the format ``xxx.xxx'', before re-enabling the framebuffer once activity resumes. The default is .25 seconds. -f framebuffer Use the framebuffer device framebuffer instead of the default /dev/fb. -i input-device Add input-device to the list of devices to monitor for activity. -k Do not check the keyboard for activity. -m Do not check the mouse for activity. -u Overriding the other options, simply try (once) to unblank the framebuffer, then exit. Note that the -k and -m flags are mutually exclusive. FILES
/dev/kbd The keyboard device. /dev/mouse The mouse device. /dev/console The console device. /dev/fb The default framebuffer. /dev/wskbd The keyboard for wscons machines. /dev/wsmouse The mouse device for wscons machines. /dev/ttyE0 The console device for wscons machines. /var/run/screenblank.pid File containing the pid of screenblank. BSD
September 23, 2006 BSD
All times are GMT -4. The time now is 09:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy