![]() |
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 |
| replace last / by | | naikaa | Shell Programming and Scripting | 6 | 01-17-2008 02:19 AM |
| How to replace into Vi | ravi.sadani19 | Shell Programming and Scripting | 5 | 06-25-2007 09:30 AM |
| Replace \n with \r\n | Chanakya.m | Shell Programming and Scripting | 3 | 07-19-2006 07:20 AM |
| How to replace using SED? | mahatma | Shell Programming and Scripting | 4 | 03-23-2006 03:04 PM |
| Replace | jda2001 | UNIX for Dummies Questions & Answers | 2 | 09-06-2005 02:20 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
replace
hi
i have input file in this format E102|0|1-23-1994|0|12-5-1994|E003|A|10450|charan,devupalli|5000 how to convert this into outfile E102,0,1-23-1994,0,12-5-1994,E003,A,10450,charan,devupalli,5000 i wann the output in excel sheet.........that is why i am converting into csv.. but i have the name file as firstname, lastname and it should be present in one column charan,devupalli Pls send me asap. thanks in advance cherry |
|
||||
|
hi
$ cat > in6
E102|0|1-23-1994|0|12-5-1994|E003|A|charan,devupalli|2000 $ sed 's/|/,/g' in6 > out6.csv $ cat out6.csv E102,0,1-23-1994,0,12-5-1994,E003,A,charan,devupalli,2000 in the excel in the excel i am getting charan and devupalli into two columns but i need to get in a single column like charan,devupalli..... thanks cherry |
|
||||
|
I'm not certain I'm following what you're saying, but if I do...
Code:
cat in|tr "|" "," > out |
|
||||
|
hi
Quote:
If i have a file like E001|0|23/01/2007|CHARAN,DEVUPALLI|4000|INDIA| !INPUT E001,0,23/01/2007,CHARAN,DEVUPALLI,4000,INDIA| !OUTPUT I CAN CONVERT THE FILE BY USING SED......AND I AM GETTING THE OUT PUT......... BUT I AM GETTING THE CHARAN IN ONE SEPARATE COLUMN AND THE DEVUPALLI IN SEPARATE COLUMN. I NEED TO GET THE CHARAN,DEVUPALLI IN A SINGLE COULMN........HOW TO DO THAT........ PLS send how to do that |
|
||||
|
dude, first, lose the caps.
second, I think your problem lies with the way u handle Excel, not in Unix. If you convert all "|" to commas, the comma becomes a delimiter and "charan,devupalli" become two seperate items, delimited by commas. A csv file does not need to have comma as a delimiter, you can set the pipe sign as a delimiter too (Use the Tools-> Text to columns and you can set the delimiter there) So you can use the very first line directly in excel, no need to mod it in unix. you're just going circles. |
|
||||
|
If you actually want to convert the separator to comma for unrelated reasons, you can have comma inside a field by putting it in double quotes. Different (per)versions of Excel have different bugs and conventions for how exactly they break when you try to do this, so you will have to experiment a bit.
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|