Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Filter results through pipe with grep Post 302079440 by ckandreou on Monday 10th of July 2006 11:28:25 AM
Old 07-10-2006
Filter results through pipe with grep

ls -ltr | grep string
How can I use regular expressions to filter the results provided even more. I am using the above command as a reference.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

What is the difference between pipe and filter?

Hi. I am bit confuse, you see i'm not to sure about the concept of pipe as used by Unix. How is pipe different from a filter? so, How is pipe different from a file redirection? Thanks, (3 Replies)
Discussion started by: mischiefdemon
3 Replies

2. UNIX for Dummies Questions & Answers

Pipe SQL select statement results to script

Hello I would like to perform a select from a oracle table and return those values to my shell script For example: site=head -1 $infile | cut -c1-15 | awk '{printf "s%", $0} sqlplus -s /nolog |& #Open pipe to sql select col1, col2, col3, col4 from oracle_table where col5 =... (6 Replies)
Discussion started by: houtakker
6 Replies

3. UNIX for Dummies Questions & Answers

Pipe results of Grep Command to LS Comand

I'm using the command grep -l XYZ to get a list of files containing the string XYZ. Then I using the comand ls -l ABC to get the create date timestamp of the each file. I've tried combining the comands using the pipe command, grep -l XYZ | ls -l, but its not working. What am I doing wrong? (3 Replies)
Discussion started by: jhtate
3 Replies

4. Shell Programming and Scripting

Filter on a grep

I am attempting to figure out how to only capture part of a grep command I am doing. So far no luck. When I execute.... leviathan:/gfs/home/tivoli>ps -ef | /usr/ucb/ps -auxww | grep nco_p_syslog The results are.... tivoli 10185 0.0 0.0 5888 5168 ? S Oct 23 0:26... (2 Replies)
Discussion started by: LRoberts
2 Replies

5. Shell Programming and Scripting

How can I execute the results of a pipe?

Hello, I'm using csh. I have a file named "setup" that I normally source, e.g. source setupI'd like a one-liner that sources this file, but excluding lines that contain "DEBUG", e.g. cat setup | grep -v DEBUG | sourceOf course, the above does not work. How can I execute the results of a... (5 Replies)
Discussion started by: acheong87
5 Replies

6. Shell Programming and Scripting

Display find results, and pipe to xargs

I have an overnight script which runs across a large directory to repair permissions and ownership. I also have this command output the list of files affected so that cron can email these as a log file. Previously I had the command in the form: find /path/to/files -not -user myname -print -exec... (4 Replies)
Discussion started by: mij
4 Replies

7. Shell Programming and Scripting

sed returns different results while substitution on a pipe delimited file

Hi, Need help with a sed command that I am using to substitute 3 positions of a pipe delimited file. i am getting different results while substituting the same position of two different files with the same value. Please see details below: $ cat chk2 ... (3 Replies)
Discussion started by: vmenon
3 Replies

8. UNIX for Dummies Questions & Answers

Pipe binary file matches grep results to file

I am using grep to match a pattern, but the output is strange. $ grep -r -o "pattern" * Gives me: Binary file foo1 matches Binary file foo2 matches Binary file foo3 matches To find the lines before/after, I then have to use the following on each file: $ strings foo1 | grep -A1 -B1... (0 Replies)
Discussion started by: chipperuga
0 Replies

9. Shell Programming and Scripting

How to launch results of a pipe?

Good afternoon, I have just messed up and deleted some directories on my UNIX machine. I would now want to know which packages are impacted by this. Therefore I have a look in the file "/var/sadm/install/contents" (which contains the filenames/directory names for each installation package). After... (2 Replies)
Discussion started by: scampsd
2 Replies

10. UNIX for Dummies Questions & Answers

Bash - CLI - grep - Passing result to grep through pipe

Hello. I want to get all modules which are loaded and which name are exactly 2 characters long and not more than 2 characters and begin with "nv" lsmod | (e)grep '^nv???????????? I want to get all modules which are loaded and which name begin with "nv" and are 2 to 7 characters long ... (1 Reply)
Discussion started by: jcdole
1 Replies
re_comp(3)						     Library Functions Manual							re_comp(3)

NAME
re_comp, re_exec - Handle regular expressions LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <regex.h> char *re_comp( char *string); int re_exec( char *string); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: re_comp(), re_exec(): XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to the string that is to be matched or converted. DESCRIPTION
The re_comp() function converts a string into an internal form suitable for pattern matching. The re_exec() function compares the string pointed to by the string parameter with the last string passed to the re_comp() function. When the re_comp() function is passed a value of 0 (zero) or NULL, the regular expression currently being converted remains unchanged. Strings passed to both the re_comp() and re_exec() functions may have trailing or embedded newline characters; however, these strings are terminated by a zero byte. The re_comp() and re_exec() functions support simple regular expressions, which are defined in the grep(1) reference page. NOTES
The re_comp() and re_exec() interfaces are scheduled to be withdrawn from a future version of the X/Open CAE Specification. These interfaces are obsolete; they are guaranteed to function properly only in the C/POSIX locale and should be avoided. Use the POSIX regcomp() interface in place of re_comp() and re_exec(). RETURN VALUES
The re_comp() function returns a value of 0 (zero) when the string pointed to by the string parameter is successfully converted; otherwise, an error message string is returned. Upon successful completion, the re_exec() function returns a value of 1 if string matches the last compiled regular expression. Otherwise, the re_exec() function returns a value of 0 (zero), if string fails to match the last compiled regular expression, and a value of -1, if the compiled regular expression is invalid (indicating an internal error). RELATED INFORMATION
Functions: regcomp(3) Commands: grep(1) Standards: standards(5) delim off re_comp(3)
All times are GMT -4. The time now is 05:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy