Home Man
Search
Today's Posts
Register

If you're not sure where to post a Unix or Linux question, post it here. All unix and Linux beginners welcome in this forum!

Format Question

Tags
awk, solved

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 12-12-2017
Format Question

Hello friends

i have a file that outputs like this:

Code:
lineA
lineB
lineC

I would like it to format it like this as output:

Code:
'lineA','lineB','lineC'

Can you help?

Thank you
# 2  
Old 12-12-2017
Hello DallasT,

Considering that your actual Input_file is same as shown sample Input_file, could you please try following and let me know if this helps you.
Code:
awk -v s1="'" -v s2="," 'val{printf s1 val s1 s2;} {val=$0} END{printf s1 val s1 RS}'  Input_file

Thanks,
R. Singh
# 3  
Old 12-12-2017
Worked beautifully my friend.

thank you!
Login to Reply

« Previous Thread | Next Thread »
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
Question about awk format franksunnn Shell Programming and Scripting 5 06-17-2013 03:52 PM
Need script for transferring bulk files from one format to text format Kranthi Kumar Shell Programming and Scripting 2 02-15-2013 04:42 AM
Converting windows format file to unix format using script sarbjit Shell Programming and Scripting 5 12-21-2010 12:00 AM
SFTP file format question wsiefkas Solaris 2 06-17-2009 04:50 PM
Disk Format Question buckhtr77 Solaris 1 05-04-2009 07:00 PM
awk/nawk question to format a file kumar04 Shell Programming and Scripting 7 03-10-2009 01:53 PM
Date format question ajgwin Shell Programming and Scripting 2 05-20-2008 09:40 PM
To convert multi format file to a readable ascii format gaur.deepti UNIX for Dummies Questions & Answers 5 03-25-2008 03:03 PM
Format question shorty UNIX for Dummies Questions & Answers 5 02-02-2006 03:56 PM
format and pkginfo -l question 98_1LE UNIX for Dummies Questions & Answers 4 03-06-2001 03:52 PM


All times are GMT -4. The time now is 06:39 PM.

Unix & Linux Forums Content Copyright1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password