Shell Programming and Scripting

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Need to move vertical to horizontal using paste

👤 Login to reply

    #8  
Old 02-16-2018
ranjancom2000 ranjancom2000 is offline
Registered User
 
Quote:
Originally Posted by rdrtx1 View Post
Code:
awk '{l=l ((!/Name:/) ? "," : ((NR>1)?d ORS:_)) $0;d=_} !/[Dd]evice/ {d=", device not found"} END {print l d}' infile


Both r same right what is the difference
Sponsored Links
    #9  
Old 02-16-2018
rdrtx1 rdrtx1 is offline Forum Advisor  
Registered Pusher
 
letter casing on word "[Dd]evice". Original post word capitalization is different from second post. Script was updated to account for both.
The Following User Says Thank You to rdrtx1 For This Useful Post:
ranjancom2000 (02-16-2018)
Sponsored Links
    #10  
Old 02-17-2018
abdulbadii abdulbadii is offline
Registered User
 
use sed

Code:
$ sed -r ':x /$/ { N; s/\n\s*/,/; /s/\):,(Name:h)/\):\n\1; bx}' sourcefile


Last edited by abdulbadii; 02-19-2018 at 01:17 AM..
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How do i do the vertical to horizontal?? nikhil jain Shell Programming and Scripting 4 03-01-2013 09:02 AM
Vertical And Horizontal Pivoting kmsekhar Shell Programming and Scripting 3 02-01-2012 06:32 AM
How to move vertical line to Horizontal... Arsh10 UNIX for Dummies Questions & Answers 3 11-15-2011 10:56 AM
vertical to horizontal andrisetia UNIX for Dummies Questions & Answers 6 10-03-2011 06:03 AM
Horizontal to vertical Xterra UNIX for Dummies Questions & Answers 3 09-09-2011 11:54 AM



All times are GMT -4. The time now is 06:52 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?