help needed in ls command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help needed in ls command
# 1  
Old 02-18-2008
Data help needed in ls command

Hi all,

i need to write an ls command which will pick up
ind_01.txt/pak_01.txt from

ind_01.txt
pak_01.txt
usa_01.txt

files in a directory..

i wrote a ls command by storing ind and pak in 2 variables and listing it. Its working fine. But the pattern to be matched should be sent in command line argument and so it should be a single variable.

i want a regular expression which will store ind/pak_01.txt. so that i can sent it in command line argument

please help..

Thanks In Advance.

Anju

Last edited by anju; 02-18-2008 at 04:23 AM..
# 2  
Old 02-18-2008
This will match ind.txt and pak.txt but will also match other combinations of these letters.
If you only have these two files in your directory, it will work for you.

Code:
 ls [ip][na][dk].txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Help needed - UNIX command

The 'env' command prints out all of the environment variables and their values. Come up with a command that prints a list of environment variables whose names end with either 'NAME', 'DIR' or 'PATH'. What I've tried. $ env | grep '' Although it highlights the part of the variables... (8 Replies)
Discussion started by: edujs7
8 Replies

2. Shell Programming and Scripting

Linux command needed

guys im new here and i need help with some linux commands. filea has keyword on each line identity aaa bbb ccc i have following commands. egrep 'www.identity' ~/home/m3 >~/home/lopo2 wc -l file ~/home/lopo2 say lopo2 has 44 lines then output saved is identity 44 (1 Reply)
Discussion started by: ahfze
1 Replies

3. UNIX for Dummies Questions & Answers

Help with Tar command needed

Lets say I have 100 files. in those files I need to search specific word and I want to tar all those files at once. how can I do that?tar -cvf test.tar |grep house *.*Will it work? Please wrap all code, files, input & output/errors in CODE tags. It makes them easier to read and preserves... (2 Replies)
Discussion started by: ded325
2 Replies

4. Shell Programming and Scripting

Command needed

Hi, I have the date as 20130101 and i need it to rephrased to 2013-01-01. Any command which can do this. (5 Replies)
Discussion started by: ATWC
5 Replies

5. UNIX for Dummies Questions & Answers

dd command help needed.

Hi I m creating a file which will serve as a virtual harddisk . I m using following command to create a file. #dd if=/dev/zero of=/tmp/Sample.dat bs=1M count=1024 I have following doubts regarding the operation. 1) In above example i m creating a file with byte size of 1M .However in... (1 Reply)
Discussion started by: pinga123
1 Replies

6. Shell Programming and Scripting

Perl command help needed

#!/bin/bash perl -nle' /(?:date|time|ref)/ and print join " ", /(?:date|time|ref)+/g or print ' inputfile Problem I have is that I want to delete words that are on the line of the 3 words above (date, time, and reference). However, I do not want to delete the words... (9 Replies)
Discussion started by: linuxkid
9 Replies

7. UNIX for Dummies Questions & Answers

Help needed with find command

Hi, I'm a complete noobie at UNIX and have hit a problem. I'm using the 'Talend' ETL tool to try and extract flat files from UNIX on a weekly basis. The dates are maintained in a control table and the appropriate folder has been mounted. I am using a component in 'Talend' which enable... (1 Reply)
Discussion started by: markee
1 Replies

8. Shell Programming and Scripting

Help Needed in understanding this command

Hi All, I search the forum for my query, Glad that got solution to it. But i really want to understand how does this command work. sed -e ':a' -e 's/\("*\),\(*"\)/\1~\2/;ta' Basically it is replacing all the comma(,) characters in between quotes with a tilde. Specially what does ':a' ,... (2 Replies)
Discussion started by: DSDexter
2 Replies

9. Shell Programming and Scripting

Solaris command needed.......

Hi can anyone tell me what command should i use to find the files which have been created within 24hrs in / . I tried with this find mtime 24 / But its not working. Pls let me know to solve the issue. (3 Replies)
Discussion started by: vinuvinod
3 Replies

10. Shell Programming and Scripting

help needed in fuser command

Hi all, I want to know if fuser command can be used to check if a file is being written or not??? Thanks In Advance Anju (1 Reply)
Discussion started by: anju
1 Replies
Login or Register to Ask a Question