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)
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT LINUX
gid
GID(1) User Commands GID(1)NAME
gid - Query ID database and report results.
SYNOPSIS
gid [OPTION]... PATTERN...
DESCRIPTION
Query ID database and report results. By default, output consists of multiple lines, each line containing the matched identifier followed
by the list of file names in which it occurs.
-f, --file=FILE
file name of ID database
-i, --ignore-case
match PATTERN case insensitively
-l, --literal
match PATTERN as a literal string
-r, --regexp
match PATTERN as a regular expression
-w, --word
match PATTERN as a delimited word
-s, --substring
match PATTERN as a substring
Note: If PATTERN contains extended regular expression metacharacters, it is interpreted as a regular expression substring. Other-
wise, PATTERN is interpreted as a literal word.
-k, --key=STYLE
STYLE is one of `token', `pattern' or `none'
-R, --result=STYLE
STYLE is one of `filenames', `grep', `edit' or `none'
-S, --separator=STYLE
STYLE is one of `braces', `space' or `newline' and only applies to file names when `--result=filenames'
The above STYLE options control how query results are presented. Defaults are --key=token --result=filenames --separator=space
-F, --frequency=FREQ
find tokens that occur FREQ times, where FREQ is a range expressed as `N..M'. If N is omitted, it defaults to 1, if M is omitted it
defaults to MAX_USHRT
-a, --ambiguous=LEN
find tokens whose names are ambiguous for LEN chars
-x, --hex
only find numbers expressed as hexadecimal
-d, --decimal
only find numbers expressed as decimal
-o, --octal
only find numbers expressed as octal
By default, searches match numbers of any radix.
--help display this help and exit
--version
output version information and exit
REPORTING BUGS
Report bugs to bug-idutils@gnu.org
SEE ALSO
The full documentation for gid is maintained as a Texinfo manual. If the info and gid programs are properly installed at your site, the
command
info gid
should give you access to the complete manual.
gid - 4.5 August 2010 GID(1)