Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-13-2010, 10:20 PM   #1
Registered: Jul 2010
Posts: 34

Rep: Reputation: 15
concatenate 2 command into one line

Hi all,
I'm trying to concatenate two command in one line.
Below are the commands;

ls $variable || grep -i / credit card
if grep "credit card" *.tmp

then ... fi
* variable ="/portal/apll/nad/send"

i wanted to list all files in /portal/apll/nad/send and grep only .tmp files that contains credit card word.

anyone can please guide me on this?

thanks in advance.
Old 10-14-2010, 01:51 AM   #2
Registered: May 2010
Distribution: Debian, RHEL, AIX, Solaris, HP-UX
Posts: 61

Rep: Reputation: 4
ls $variable | egrep -i 'credit|card|.tmp'
Hope I did get what you're trying to point out. If not, then just explain it a bit more.

Last edited by ionrivera; 10-14-2010 at 02:03 AM.
Old 10-14-2010, 09:57 AM   #3
LQ Newbie
Registered: Oct 2010
Posts: 25

Rep: Reputation: 2
If the filenames contain the 'credit card' words You can do sth like this:

ls $variable/*credit*card*.tmp
To get *.tmp files containing the 'credit card' words inside the file

grep -l -i 'credit card' $variable/*.tmp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] concatenate two files with a new line character between them rajesekhar Linux - Newbie 4 09-02-2010 04:44 PM
Want to print fouth line after resulted line using grep with tail command saurabhmehan Linux - Newbie 10 08-05-2010 12:38 AM
awk command line: blank line record sep, new line field sep robertmarkbram Programming 4 02-21-2010 06:25 AM
concatenate mpeg (vob) files, command line tool. kaz2100 Linux - Software 2 02-09-2008 06:42 PM
xine command line? or some other command line only engine? lumix Linux - Software 2 08-10-2007 11:46 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:16 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration