![]() |
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 |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to combine fields from different files | littleb | Shell Programming and Scripting | 2 | 3 Weeks Ago 04:23 AM |
| plus values from two files differient fields. | jimmy_y | Shell Programming and Scripting | 4 | 06-23-2009 04:43 AM |
| Merging two files by comparing three fields | Hunter85 | Shell Programming and Scripting | 3 | 06-10-2009 05:18 PM |
| merging fields from 2 different files. | rudoraj | Shell Programming and Scripting | 5 | 11-02-2008 02:59 AM |
| To get an output by combining fields from two different files | smriti_shridhar | Shell Programming and Scripting | 8 | 10-22-2008 06:21 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi,
I am working right now with a csv file and I want to insert an excel formula say to the 6th column. sample csv file: Code:
1234,lag,0,77,544,,7 1234,lag,222,0,7,,7 Code:
sed 's/^\(.\{17\}\)/\1word/' file.csv
Code:
1234,lag,0,77,544word,,7 1234,lag,222,0,7,word,7 Code:
1234,lag,0,77,544,word,7 1234,lag,222,0,7,word,7 I tried using the sed command i found in one the the threads here but i can only make it work to insert up to 2 columns. I don't really understand how to this works. hope somebody could help. thanks! this is not mine, I just found this command from one of the threads here: Code:
sed 's/^\([^,]*\),[^,]*,/\1,word,/' file.csv Code:
1234,word,lag,0,77,544,,7 1234,word,lag,222,0,7,,7 Thanks! Last edited by Franklin52; 2 Weeks Ago at 06:37 AM.. Reason: Please use code tags! |
|
||||
|
Code:
awk -F, -v OFS=, '{ $6 = "word" } 1' file1
1234,lag,0,77,544,word,7
1234,lag,222,0,7,word,7
Code:
sed "s/,,/,word,/" file1 1234,lag,0,77,544,word,7 1234,lag,222,0,7,word,7 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|