Ubuntu :: Piping Command Output Into Grep As Search Term?

Nov 11, 2010

I want to pipe the output of a command into grep as the search TERM, rather than the text to be searched, like this for example

Code:

cat /var/log/auth.log | grep date "&b &d"

so that I only see the lines in auth.log for the current day...but obviously that line doesn't work.... is there a way to do this with grep, or even another command?

View 4 Replies


ADVERTISEMENT

Ubuntu :: Output Files Containing Search Term?

Feb 25, 2010

I would like to search for a term within a batch of text files and copy the files containing that term to a folder.

I've read the man pages for Grep, Ack-grep and looked through nautilus, dolphin, midnight commander as well as tried beagle, tracker and google desktop (and looked throught these forums).

I can do this function easily with xp's wagging dog in the Windows search, but would like to find a way in Linux.

View 5 Replies View Related

Ubuntu :: Search Files Containing A String / Grep Command?

Sep 1, 2011

how to search for those files which contain word "AM_COLLECTION=22". I need to know all the files with this string. ( I know the grep command can do it but either

View 4 Replies View Related

Ubuntu :: Output Of Command In Less And The Words Highlighted By Grep?

Sep 1, 2010

So theres this command

Code:
man -k mail
Which lists commands that contain the keyword "mail" in their description.I want the output of this command in less and the words highlighted by grep. Something like

Code:
man -k mail | grep mail | less
The command doesn't work, how do I fix it?

View 2 Replies View Related

General :: Exec Command With Grep Output?

Feb 15, 2011

I have a requirement to find the files having its name as ack_reply. However, there are many other files in the same directory as these resides. Now I have to remove these files from the folder and retain others after 7 days. So I tried to write the below script with grep command.

find $directory -type f -mtime +7 | grep ack_reply

how can I pass this output to -exec command.

If I am not using grep command my script would be as

find $directory -type f -mtime +7 -exec remove.sh {}\;;

How can I use -exec with grep and find.

View 4 Replies View Related

Ubuntu :: Editor Which Can Highlight A Search Term?

Oct 20, 2010

I'm looking for a simple text editor which could highlight all occurrences of search term in the opened text file. This is a feature that I particularly like in the Windows Notepad++ editor where any selected word is automatically highlighted in the rest of the document.

View 5 Replies View Related

Ubuntu :: Search For Term In Multiple Files?

Mar 7, 2011

I am trying to search for a term in a bunch of files. Is there a way to do this. I would like to search all the files in a directory and its subdirectories for a specific term.

View 1 Replies View Related

Ubuntu :: Piping The Output Of The Shell To Notify-osd?

Apr 30, 2010

how would you go about piping the output of the shell to notify-osd?

View 5 Replies View Related

General :: Piping Output Of List To Cp?

May 16, 2011

I have the following code

Code:

ls ~/ | grep ^[[:lower:]]

and would like to take the result of this output and use this as the basis for a cp command to move these files to another folder.

View 3 Replies View Related

Programming :: Piping Cat Output To Variable?

Jan 10, 2010

New to ubuntu and shell scripting in general... currently I stored some data into a text file. Right now, I would like to output the data from the text file and store it into a variable. Here's what I have so far:

READ_FILE=$(cat $FILE_NAME)

This definitely works and READ_FILE has the necessary data. However, this command will trigger an output to std output and I will see data on the screen, which is not what I want. I tried:

cat $FILE_NAME | $READ_FILE

and various other variants of this. It does not output to std output but neither does anything gets stored into $READ_FILE. I tried:

cat $FILE_NAME >> $READ_FILE

and it arrived at an error of "ambiguous redirect".

View 12 Replies View Related

Software :: Alternative To Cat For Piping Dvb Output To File?

May 12, 2010

I am looking for an alternative to cat for streaming the output (ATSC) of a dvb card to a file. cat works fine for a bit but there is some internal variable that reaches a size limit and stops it. As evident by the c error "variable has reached size limit" (sorry for the paraphrase I do not have the error in front of me.) That is ok, a co worker who knows c told me the best thing to do is to find some other utility to do this. cat /dev/dvb/adapter0 > test.mpg is what I am looking to replace. how to pipe this into some sort of compression utility.

View 4 Replies View Related

Ubuntu :: Building A Dictionary With A Bash Script - Piping The Output To A File

Sep 5, 2010

i'm building a dictionary with a bash script. it works perfect except i'd prefer something faster. btw i'm just piping the output to a file.

[Code]...

View 1 Replies View Related

Ubuntu :: Grep Can't Search Pdf File?

Jun 2, 2010

i want to search some key words in some pdf files grep myword ~/test.pdf that command can't work! grep command can't search pdf file??

View 1 Replies View Related

General :: Determine The Actual Command That Is Piping?

Feb 11, 2011

Let's say I have a bash script called log.sh. In this script, I want to read in input from a pipe, but I also want to know the command used to pipe input into me. Example:

tail -f /var/log/httpd/error | log.sh

In the shell script, I want to know the command tail -f /var/log/httpd/error.

View 2 Replies View Related

General :: Details On Piping Information Into Command

Feb 15, 2011

I am sure this has been covered before, however I do not know which terms to sue for searching for this, so I will try and explain it.

I have a program that I run at startup to connect me to my work VPN, specifically the Cisco VPN client. When running the program, it prompts me for my username and password. I would like to be able to automate the login process by piping the username and password into the program everytime it starts up (username and password cannot be passed as arguments to the program)

Something like echo username | echo password | vpn_script

View 2 Replies View Related

Programming :: Grep Search Between N-m

Oct 5, 2010

How can i use grep (or any other command) to check for lines that begin with N number.

E.g. I want to print out commands (from history), but only from the command number 50 until #200.

This one doesn't work:

Code:
history | grep "^[50-200]"
Should print out something like:
Code:
50 cd ~/Desktop

[Code].....

View 4 Replies View Related

Ubuntu :: GREP - Return Only Search String?

Jan 13, 2011

I have a mail.log file, of which I want to redirect only the search strings of the sender from=<example.sender@exampledomain.com> and the size size=4537 to a file.

In every case the sender string starts as from=<> and the size string starts as size=

What would be the grep command to redirect only the two search strings to a .txt file?

View 2 Replies View Related

Ubuntu :: Is There A Variation Of Grep To Search Files For Keywords

Jul 10, 2010

I know you can use grep to find keywords in filenames, but is there a variation that can enable you to search the content of the files themselves?

View 9 Replies View Related

General :: Use Grep To Search For Multiple Options?

May 20, 2010

How can I use grep to search for line with either 'res' or 'rep'? i try "grep -e res|rep" or gre -e "rep|rep" but that does not work.

View 3 Replies View Related

General :: Search For A String In A Php File Using `grep`?

Jan 19, 2010

I am searching for Class declaration on a site with hundreds of PHP files, how can I do this in the current folder and subfolders using GREP?

I tested cding to the folder and then something like

grep -r 'class MyClass' *.php

View 5 Replies View Related

General :: Search A Grep For A Magic Word?

Feb 16, 2011

I am using ascript for general users to back up usb drives to lto4 tapes.. I wish to ahve some error checking to check IF is there is a tape in the tape drive to check for the tape:

if i do a
sudo mt -f /dev/st0 status
i will get back a
mt: /dev/st0: rmtioctl failed: Input/output error
if there is no tape in the drive or
sudo mt -f /dev/st0 status

[code].....

View 4 Replies View Related

General :: Using Grep / Awk To Search For Colored Text

Sep 17, 2010

I have done a bunch of searches on this but the terms seem to get tangled in the more popular search of "colouring the output of grep / awk". I am trying to find a way to grep/awk through the output of a command to find text of a specific colour. The command's output has a range of colours signifying too many different things to specify using text, with colour being the only form of grouping.

View 5 Replies View Related

General :: GREP - Search Special Characters

Feb 10, 2010

I need to search for the following pattern with GREP in a text file:

So I tried already:

But none of those works...I think probably because GREP doens't like the special character > in the middle of the serach pattern.

At the end I just need to now if GREP found the pattern in the file or not, so it should give me a 0 or a 1 back, once I check the value of the variable "?" after using the grep command.

View 4 Replies View Related

Fedora :: Terminal : Set Font And Term From Command Line?

Aug 3, 2010

I need to set both my font size and my term ($TERM=vt220) from the command for a /usr/bin/terminal. Is there a way for me to do this?

View 2 Replies View Related

General :: Correct Usage Of Grep To Search A Disk?

Mar 26, 2009

I've been trying to identify all files on my cut-down version of Damn Small which contain the text string "User Agent:" in them. Because it's only 120Mb in its entirety, I'm quite happy to have grep search the whole system. I'm using this command, but it just generates errors as you can see:

[root@localhost ~]# grep -R 'User Agent:' /*
grep: /dev/dri/card0: Invalid argument
grep: /dev/fuse: Operation not permitted

[code]....

View 13 Replies View Related

General :: Search Date Period In Access Log Using Grep ?

Feb 19, 2010

I have a three input day,month and year. Currently i am using the following script to take the data.

Any grep advanced technique to avoid for loop?

View 2 Replies View Related

Debian :: Grep Not To Show Ones Containing "term" / "string"

Jan 7, 2010

it should be simple, but i don`t get it: if i search for stuff, i may pipe it to grep to "filter" it:

Code:
ls /usr/bin | grep ice

but how would i say grep not to show the ones containing "term"/"string" example would be with locate

Code:
locate fluxbox | -> but not the ones in /home

View 4 Replies View Related

Fedora :: Configure Grep To Search Recursively Through All Files In A Directory?

Oct 1, 2010

somewhere lurking is a file containing the default print resolution, which is not being overwritten by printer settings or cups management. I've asked on the cup forum and nothing successful.

So here's the question:

How can I configure grep to search recursively through all files in a directory, or if need be starting from root to find the pattern "2880" I've looked in the man page for grep and I can't see how to do it, is grep the right tool to use for this ?

View 2 Replies View Related

Software :: Grep Recursive Search Directory Depth Option ?

Feb 28, 2011

I know grep can search recursively (ie through all subdirectories to the bottom of the directory tree), but is it possible to ask grep to only search say, 3 levels down? That means the current directory, any directories in the current directory, and within any directories within those?

View 1 Replies View Related

General :: How To Make Grep To Search A Pattern In Only Specific File Type?

Mar 6, 2010

To search a string pattern in all files in a directory and subdirectories, I am using;

Code:
grep -R "myclass::my-func(" mydirectory/
Now I want grep, to search in only specific file types say *.cc. Please help me. I have read manual of grep, but could not deduce any hint.
Best Regards.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved