Cutting values with delimiter


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cutting values with delimiter
# 1  
Old 05-12-2014
Cutting values with delimiter

Hi All,

I have a string with , delimiter

america,finland,netherlands

Now i want these values to be stored in file as below with newline character at end of each value

america
finland
netherlands

Regards
Prasad
# 2  
Old 05-12-2014
try
Code:
nawk '{for (i=1;i<=NF;i++) {print $i}}' FS=, filename

# 3  
Old 05-12-2014
Code:
 echo 'america,finland,netherlands' | tr , '\n'

This User Gave Thanks to vgersh99 For This Post:
# 4  
Old 05-12-2014
Code:
xargs -d, -n1 < file

Code:
awk 'gsub(",",RS)' file

Code:
awk 1 RS=, file

This User Gave Thanks to Yoda For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cutting string values from a file

My file looks like this.... User:SYSTEM,O/S User:oracle,Process:3408086,Machine:hostname ,Program:sqlplus@hostname (TNS V1-V,Logon Time:25-JUL-20 14 13:36 I want to get the date and time which is displayed after the 'Logon time'. (5 Replies)
Discussion started by: Nagesh_1985
5 Replies

2. Shell Programming and Scripting

Grep null values in a file with no delimiter

Hi Folks, We have a file that has null values but there are no delimiters. So all columns are considered as a single column. Ex: abc def 123 abcdef1234567 hijklmn7896545 Now from "a" till "3" all are considered as a single column from the first row. Our requirement is like, we... (2 Replies)
Discussion started by: jayadanabalan
2 Replies

3. Shell Programming and Scripting

Cutting a string using more than one character as delimiter

Hi , I have a set of files in a folder which i need to cut in to two parts.... Sample files touch AE_JUNFOR_2014_MTD_2013-05-30-03-30-02.TXT touch AE_JUNFOR_2014_YTD_2013-05-30-03-30-02.TXT touch temp_AE_JUNFOR_2014_MTD_2013-05-30-03-30-02.TXT touch... (4 Replies)
Discussion started by: chillblue
4 Replies

4. Shell Programming and Scripting

Cutting a part of line till delimiter

here are the few scenarios... isoSizeKB text NOT NULL, reserved1 varchar(255), KEY `deviceId` (`deviceId`) `d5` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `dHead` enum('HistoryInfo','Diversion') COLLATE utf8_unicode_ci, `ePR` int(11) DEFAULT '0', PRIMARY KEY (`id`) ... (7 Replies)
Discussion started by: vivek d r
7 Replies

5. UNIX for Dummies Questions & Answers

cutting columns if delimiter has more than one charecter (|^)

Hi All, I am having a file with the delimiter '|^'. File name:test_dlim.csv I want to cut the first field of this using awk command. I tried with the help of the following link:... (2 Replies)
Discussion started by: boopathyvasagam
2 Replies

6. Shell Programming and Scripting

php setcookie multiple values with delimiter

Hi all, setting a cookie multiple values with delimiter $value = 'TM=1276245099:LM=1276245099'; // etc etc setcookie('unix',"$value"); This generates %3ATM%3D1276245099%3ALM%3D1276245099 I want the data as it is TM=1276245099:LM=1276245099 Any suggestions? (0 Replies)
Discussion started by: ./hari.sh
0 Replies

7. UNIX for Dummies Questions & Answers

Cutting a portion of a line seperated by pipe delimiter

Hi, In the below line a|b|10065353|tefe|rhraqs|135364|5347575 dgd|rg|4333|fhra|grhrt|46423|urdsgd Here i want to cut the characters in between the second and third pipe delimiter and then between fifth and sixth delimiter and retain the rest of the line. My output should be ... (3 Replies)
Discussion started by: ragavhere
3 Replies

8. Shell Programming and Scripting

Cutting a tab delimiter file

I have a 30 column tab delimited record file. I need to extract the first 10column. The following command to cut was not working cut -f 1-10 -d "\t" filename. Could any one keep on this . Thanks in Advance (4 Replies)
Discussion started by: vinod.thayil
4 Replies

9. UNIX for Dummies Questions & Answers

cutting columns if delimiter has more than one charecter

Hi, My file looks like abc$%sdfhs$%sdf$%sdfaf$% here as seen delimiter is $%...now how cas i take out second field as cut command expect delimiter as single charecter only.....is there is any other way thanks and regards mahabunta (9 Replies)
Discussion started by: mahabunta
9 Replies

10. Shell Programming and Scripting

Problem cutting & comparing values

Hi guys I am having some problem cutting and comparing values.I got an INI file which is has some values and ranges mapping to error and warning codes eg criticalerror:69,20,1to9 warningmsg:101,10to19 So taking the scenrio where i have a control script that execute a.ksh, when a.ksh... (6 Replies)
Discussion started by: wilsontan
6 Replies
Login or Register to Ask a Question