LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-13-2010, 09:20 PM   #1
tedy2808
Member
 
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;

Code:
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, 12:51 AM   #2
ionrivera
Member
 
Registered: May 2010
Distribution: Debian, RHEL, AIX, Solaris, HP-UX
Posts: 61

Rep: Reputation: 4
Code:
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 01:03 AM.
 
Old 10-14-2010, 08:57 AM   #3
fiku
LQ Newbie
 
Registered: Oct 2010
Posts: 25

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

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

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


Reply



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 03:44 PM
Want to print fouth line after resulted line using grep with tail command saurabhmehan Linux - Newbie 10 08-04-2010 11:38 PM
awk command line: blank line record sep, new line field sep robertmarkbram Programming 4 02-21-2010 05:25 AM
concatenate mpeg (vob) files, command line tool. kaz2100 Linux - Software 2 02-09-2008 05:42 PM
xine command line? or some other command line only engine? lumix Linux - Software 2 08-10-2007 10:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:34 AM.

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