Linux - Script to generate the output delimited by Comma/Pipe | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Linux - Script to generate the output delimited by Comma/Pipe

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-22-2012
dsfreddie dsfreddie is offline
Registered User
 
Join Date: Dec 2011
Last Activity: 4 March 2013, 5:31 AM EST
Posts: 69
Thanks: 8
Thanked 0 Times in 0 Posts
Linux - Script to generate the output delimited by Comma/Pipe

Hi All,

I have a requirement where I need to go to a directory, list all the files that start with person* (for eg) & read the most recent file from the list of files.

While browsing through the forum, i found that the command ls -t will list the files. I am trying to generate the output of this command in pipedelimited/comma separated format.

ie like person.20120104|person.20120103|person.20120102

Can you pls help me with the Linux command for the same.

Thanks,
Freddie
Sponsored Links
    #2  
Old 01-22-2012
ahamed101's Avatar
ahamed101 ahamed101 is offline Forum Advisor  
root is god!!!
 
Join Date: Sep 2008
Last Activity: 19 December 2014, 1:52 AM EST
Location: San Jose, CA
Posts: 1,910
Thanks: 54
Thanked 486 Times in 479 Posts
Try this...
Code:
ls -t person* | tr '\n' '|'

--ahamed
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Remote command output to file comma delimited markdjones82 Shell Programming and Scripting 0 06-10-2010 10:57 AM
Converting comma separated to pipe delimited file anijan Shell Programming and Scripting 15 05-17-2010 07:38 AM
Need help with shell script for chekking a column in txt file - pipe delimited ravi0435 UNIX for Dummies Questions & Answers 12 01-02-2009 04:31 PM
How to generate a pipe ( | ) delimited file? anushree.a Shell Programming and Scripting 5 10-15-2008 03:35 AM
Comma Delimited Output w/ egrep indianadoug Shell Programming and Scripting 2 03-10-2005 04:20 PM



All times are GMT -4. The time now is 11:45 AM.