Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Bash - CLI - grep - Passing result to grep through pipe Post 302632267 by jcdole on Sunday 29th of April 2012 05:00:21 PM
Old 04-29-2012
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"

Code:
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

Code:
lsmod | (e)grep  '^nv????????????

I want to get all modules which are loaded and which name begin with "n" and finish with "a" and are 6 characters long

Code:
lsmod | (e)grep  '^n????????????

Thank you for helping

JCD

Last edited by radoulov; 04-29-2012 at 06:44 PM.. Reason: Code tags!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep to handle a 0 result

Hi guys, I have the following grep command in a script to search through a file for a string and return its count, and it works fine for when the string exists: grep "string" file.txt | wc However, sometimes the result will be 0 and I want the script to take this as the result. Right now... (6 Replies)
Discussion started by: ocelot
6 Replies

2. Shell Programming and Scripting

diaplaying the grep result

Hi, My code is like this if swlist -a revision 2>/dev/null | grep ABC 2>/dev/null then echo "Found Above mentioned ABC Version, please remove it first..." fi This is displaying the result to the screen. i want to first suppress that and for that i wrote the below... (1 Reply)
Discussion started by: rag84dec
1 Replies

3. Shell Programming and Scripting

How to negate grep result?

Here is my script so far: set dirs = ` find . -name "message.jar" 2> /dev/null | cut -d "/" -f 2 ` | uniq foreach dir ( $dirs ) if (grep $dir/* someText==null) --> how do I write this in script? print $dir end end (4 Replies)
Discussion started by: mmdawg
4 Replies

4. Shell Programming and Scripting

pipe result from grep

Trying to create a command line script to look for all files matching a pattern, grep for a specific value in each file, and write out the filename long list. It's possible the filename won't containe the value. { echo “Running....” for fname in 811_Intermediate_File_* do grep -l... (3 Replies)
Discussion started by: gavineq
3 Replies

5. UNIX for Dummies Questions & Answers

grep, expecting 1 result, getting more

Hi Please take a look below, I'm grepping for /app/oracle and would like explicitly that result and not /app/oracle/admin as well. # cat /tmp/fs.list /app/oracle /app/oracle/admin # cat /tmp/fs.list | grep -w "/app/oracle" /app/oracle /app/oracle/admin (3 Replies)
Discussion started by: s1ckle
3 Replies

6. Shell Programming and Scripting

Passing variables from bash to php-cli

Hello everyone, I've been looking how to pass variables between bash and php-cli in 1 file. So far i got this: #!/bin/bash echo "This is bash" php << EOF <?php echo "This is php\n"; ?> EOF I would now like to be able to pass a variable declared in the bash to the php. I already... (0 Replies)
Discussion started by: robbee
0 Replies

7. UNIX for Dummies Questions & Answers

Pipe grep to rm

We have a number of OS X 10.6 machines who have home folders with incorrect permissions, which are causing managed prefs not to be applied correctly and not allowing saving. I need to delete all home folders whose name is numerical and modified before a certain date. I'm not sure of the date part... (2 Replies)
Discussion started by: airlocksniffer
2 Replies

8. Solaris

grep result in newline

Hi While trying to do a search on solaris, the grep results seems to be appearing on the same line instead of the new line. Wed Jan 18 14:45:48 weblogic@test:/abcd$ grep qainejb02 * qa_cluster_biz_view_tc_intl_servers_ports_2:qainejb02 7101 qa_cluster_servers_2:qainejb02... (2 Replies)
Discussion started by: ganga.dharan
2 Replies

9. Shell Programming and Scripting

pipe to grep doesn't work in bash script

Hi, I'm trying to write a script that checks gvfs to see if a mount exists so I can run it from network-manager's status hooks. I thought I'd pipe the output of gvfs-mount -l to grep for the particular mounts I care about. When I do this in a bash script: cmnd="gvfs-mount -l | grep -i... (4 Replies)
Discussion started by: kcstrom
4 Replies

10. Shell Programming and Scripting

Grep result from dd command

Hi, I am running following command in a bash script for testing IO and use grep to get throughput number, but it did not work, it displayed everything: dd if=/dev/zero of=/dev/null bs=1G count=1 oflag=dsync | grep bytes | awk '{print $7}' 1+0 records in 1+0 records out 536870912 bytes... (2 Replies)
Discussion started by: hce
2 Replies
LSMOD(8)						       Linux Module Support							  LSMOD(8)

NAME
lsmod - list loaded modules. SYNOPSIS
lsmod [-hV] DESCRIPTION
lsmod shows information about all loaded modules. The format is name, size, use count, list of referring modules. The information displayed is identical to that available from /proc/mod- ules. If the module controls its own unloading via a can_unload routine then the user count displayed by lsmod is always -1, irrespective of the real use count. OPTIONS
-h, --help Display a summary of options and immediately exit. -V, --version Display the version of lsmod and immediately exit. SEE ALSO
insmod(8), modprobe(8), depmod(8), rmmod(8), ksyms(8) HISTORY
Module support was first conceived by Anonymous Initial Linux version by Bas Laarhoven <bas@vimec.nl> Version 0.99.14 by Jon Tombs <jon@gtex02.us.es> Extended by Bjorn Ekwall <bj0rn@blox.se> Updated for 2.1.17 by Richard Henderson <rth@tamu.edu> Updated by Bjorn Ekwall <bj0rn@blox.se> in March 1999 Linux February 4, 2002 LSMOD(8)
All times are GMT -4. The time now is 06:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy