![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Format a text file | jhardy | Shell Programming and Scripting | 2 | 03-17-2009 02:32 PM |
| changing the format of CSV file | ashis.tewari | Shell Programming and Scripting | 5 | 12-09-2008 07:38 AM |
| Changing display and format of file | wahi80 | UNIX for Dummies Questions & Answers | 1 | 08-02-2008 08:12 PM |
| Conver Excel file to another format ( text) | ZINGARO | HP-UX | 6 | 07-23-2008 01:52 PM |
| Changing the column for a row in a text file and adding another row | aYankeeFan | Shell Programming and Scripting | 9 | 05-02-2005 09:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Changing the text file format
Hi,
I have a shell script to unload all the empname who have salary >50000 from the emp table into a text file(empname.txt) . m_db unload "$dbc_file" -column_delimiter ',' -select "SELECT empname FROM emp where salary > 50000" >> empname.txt Now my text file have data in the following format cat empname.txt kkk, abc, efg, hij, lmn, ..., etc I want to change all these values in the below mentioned format and each string should have single codes. cat empname.txt 'kkk','abc','efg','hij','lmn','...','...',etc How can I change this in the shell script?.If anybody knows please help me to resolve this. |
|
|||||
|
Quote:
Code:
sed "s/[^,][^,]*/'&'/;\$s/,$//" empname.txt| tr -d '\n' |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|