No need path in output of LS command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting No need path in output of LS command
# 1  
Old 12-29-2010
No need path in output of LS command

hi,

while i am placing the command.
Code:
ls /app/callidus/rci_vst_p1/vst_fact_sms_cdr*

I am getting the below ouput..
Code:
Output
/app/callidus/rci_vst_p1/Inbound/vst_fact_sms_cdr_20101124.dat
/app/callidus/rci_vst_p1/Inbound/vst_fact_sms_cdr_20101215.dat
/app/callidus/rci_vst_p1/Inbound/vst_fact_sms_cdr_20101215.tch

But i don't want path...Please do the needfull.

Advance Thanks
Siva

Last edited by Franklin52; 12-29-2010 at 09:10 AM.. Reason: Please use code tags
# 2  
Old 12-29-2010
Code:
ls /app/callidus/rci_vst_p1/vst_fact_sms_cdr* | basename

R0H0N
# 3  
Old 12-29-2010
Thanks....
but i am getting error.
I have used this...it is working fine.
Code:
ls /app/callidus/rci_vst_p1/vst_fact_sms_cdr* | xargs -n1 basename


Moderator's Comments:
Mod Comment Please use code tags when posting data and code samples!

Last edited by Franklin52; 12-29-2010 at 09:10 AM..
# 4  
Old 12-29-2010
Code:
cd /app/callidus/rci_vst_p1

find . -name "vst_fact_sms_cdr*" -print

# 5  
Old 12-30-2010
Code:
( cd /app/callidus/rci_vst_p1; ls vst_fact_sms_cdr* )

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Command to see the logical volume path, device mapper path and its corresponding dm device path

Currently I am using this laborious command lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}' Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

2. UNIX for Beginners Questions & Answers

How to use printf to output a shell variable path?

So I created two shell variables: COLUMN1_HEADING, COLUMN2_HEADING. They have values: COLUMN1_HEADING="John" COLUMN2_HEADING="123456789" How would I use printf to get it to print an output like this: $COLUMN1_HEADING\t$COLUMN2_HEADING\nJohn\t123456789\n Thanks! (3 Replies)
Discussion started by: steezuschrist96
3 Replies

3. UNIX for Dummies Questions & Answers

Extract name from path and change output

Dear All, I would like to extract the file name without extension form a variable... In particular I have a command like this one: for file in path/to/file/example_number.ext do something -input $file -output ${file%_number.ext}.new done means that in variable $file are saved all the path... (3 Replies)
Discussion started by: giuliangiuseppe
3 Replies

4. Shell Programming and Scripting

Insert title as output of command to appended file if no output from command

I am using UNIX to create a script on our system. I have setup my commands to append their output to an outage file. However, some of the commands return no output and so I would like something to take their place. What I need The following command is placed at the prompt: TICLI... (4 Replies)
Discussion started by: jbrass
4 Replies

5. Shell Programming and Scripting

Parse output path to set variable

I am looking to parse a text file output and set variables based on what is cropped from the parsing. Below is my script I am looking to add this feature too. All it does is scan a certain area of users directories for anyone using up more than X amount of disk space. It then writes to the... (4 Replies)
Discussion started by: es760
4 Replies

6. Shell Programming and Scripting

Need to split the $PATH output

Hi, /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin i want to print the above output as below /usr/kerberos/sbin /usr/kerberos/bin /usr/local/sbin /usr/local/bin /sbin /bin /usr/sbin /usr/bin... (5 Replies)
Discussion started by: kmvinay
5 Replies

7. UNIX for Dummies Questions & Answers

Command display output on console and simultaneously save the command and its output

Hi folks, Please advise which command/command line shall I run; 1) to display the command and its output on console 2) simultaneous to save the command and its output on a file I tried tee command as follows; $ ps aux | grep mysql | tee /path/to/output.txt It displayed the... (7 Replies)
Discussion started by: satimis
7 Replies

8. UNIX for Dummies Questions & Answers

create PATH from find command output

I'm trying to autogenerate a PATH variable from the output of a find command as follows: PATH=`find $dir -name "*.jar" | sed 's/$/:/'` The output looks similar like this if I echo it: PATH=/path/to/1.jar: /path/to/2.jar: /path/to/3.jar: I want the path to be on one line. I'm on... (3 Replies)
Discussion started by: rein
3 Replies
Login or Register to Ask a Question