changing the format of the list


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting changing the format of the list
# 1  
Old 04-27-2011
changing the format of the list

I have a file such that

Code:
List : a, b, c, d

I want to list this as
Code:
List
a
b
c
d

however the trick is the number of arguments in the list is varies. There might be 0-7 variables .

Can you help me?
Moderator's Comments:
Mod Comment
Please use code tags when posting data and code samples!

Last edited by vgersh99; 04-27-2011 at 03:55 PM.. Reason: code tags, please!
# 2  
Old 04-27-2011
Code:
echo 'List : a, b, c, d'|tr ':,' '\n\n'

# 3  
Old 04-27-2011
And what if i have the list such as

Code:
a,b,c,d

I couldn't edit it.

Last edited by vgersh99; 04-27-2011 at 04:38 PM.. Reason: code tags, PLEASE!
# 4  
Old 04-27-2011
Quote:
Originally Posted by ozum
And what if i have the list such as

a,b,c,d

I couldn't edit it.
Code:
$ echo 'a,b,c,d' | tr ':,' '\n\n'
a
b
c
d

Anything wrong with that?
# 5  
Old 04-27-2011
It workds thanks..
I tried it before but I didnt realise it worked because of screen settings..

Thanks again..
# 6  
Old 04-28-2011
try this......

Code:
$ echo " a, b, c, d" | tr ',' '\n'
 a
 b
 c
 d

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Changing the file name format

Hello all, I am tryign to change the format of files (which are many in numbers). They at present are named like this: SomeProcess_M-130_100_1_3BR.root SomeProcess_M-130_101_2_3BX.root SomeProcess_M-130_103_3_3RY.root SomeProcess_M-130_105_1_3GH.root SomeProcess_M-130_99_1_3LF.root... (7 Replies)
Discussion started by: emily
7 Replies

2. Shell Programming and Scripting

Changing date format

how do i change the following to show me what the date was 7 days ago? date +%Y-%m-%d (1 Reply)
Discussion started by: SkySmart
1 Replies

3. Shell Programming and Scripting

Changing the date format

Hi all, I have a file with below data af23b|11-FEB-12|acc7 ad23b|12-JAN-12|acc4 as23b|15-DEC-11|acc5 z123b|18-FEB-12|acc1 I need the output as below:-(date in yyyymmdd format) af23b|20120211|acc7 ad23b|20120112|acc4 as23b|20111215|acc5 z123b|20120218|acc1 Please help me on this.... (7 Replies)
Discussion started by: gani_85
7 Replies

4. UNIX for Advanced & Expert Users

Changing the date format

Hi All, I am new to this forum, could any one help me out in resolving the below issue. Input of the flat file contains several lines of text for example find below: 5022090,2,4,7154,88,,,,,4/1/2011 0:00,Z,L,2 5022090,3,1,6648,88,,,,,4/1/2011 0:00,Z,,1 5022090,4,1,6648,88,,,,,4/1/2011... (0 Replies)
Discussion started by: av_sagar
0 Replies

5. UNIX for Dummies Questions & Answers

Changing from Excel date format to MySQL date format

I have a list of dates in the following format: mm/dd/yyyy and want to change these to the MySQL standard format: yyyy-mm-dd. The dates in the original file may or may not be zero padded, so April is sometimes "04" and other times simply "4". This is what I use to change the format: sed -i '' -e... (2 Replies)
Discussion started by: figaro
2 Replies

6. Shell Programming and Scripting

Changing Date format

How to change a date stored in a variable to YYYYMMDD. Variable output is in DD-MON-YY,required format is 'YYYYMMDD' Thanks, Sud (1 Reply)
Discussion started by: sud
1 Replies

7. Shell Programming and Scripting

changing month in Mmm format to mm FORMAT

i have an variable mydate=2008Nov07 i want o/p as in variable mymonth=11 (i.e nov comes on 11 number month) i want some command to do this for any month without using any loop. plz help me (1 Reply)
Discussion started by: RahulJoshi
1 Replies

8. Shell Programming and Scripting

Changing date format

Hi, I have a column in a table of Timestamp datatype. For Example : Var1 is the column 2008-06-26-10.10.30.2006. I have Given query as date(var1) and time (var1) I got the file as in the below format : File1: Col1 Col2 2008-06-02|12.36.06 2008-06-01|23.36.35 But the problem is... (7 Replies)
Discussion started by: manneni prakash
7 Replies

9. Shell Programming and Scripting

changing format

Dear Experts, Currently my script is gereating the output like this as mentioned below. 8718,8718,0,8777 7450,7450,0,7483 5063,5063,0,5091 3840,3840,0,3855 3129,3129,0,3142 2400,2400,0,2419 2597,2597,0,2604 3055,3055,0,3078 4249,4249,0,4266 4927,4927,0,4957 8920,8920,0,8978... (4 Replies)
Discussion started by: shary
4 Replies

10. UNIX for Dummies Questions & Answers

Changing the format of date

Hi, There are lots of threads about how to manipulate the date using date +%m %....... But how can I change the default format of the commad date? $ date Mon Apr 10 10:57:15 BST 2006 This would be on fedora and SunOs. Cheers, Neil (4 Replies)
Discussion started by: nhatch
4 Replies
Login or Register to Ask a Question