09-02-2008
doubt in grep command
Hello
i am new shell scripting.
I have a file like this,
$ cat myfile
[%XYZ12345%];/abc/abc.cpp@@/main/1;xyz
[%XYZ12345%];/abc/abc.cpp@@/main/2;usr2
[%XYZ2345%];/abc/abc.cpp@@/main/1;abc
[%XYZ98989%];/abc/abc.cpp@@/main/2;usr2
[%abc%];/abc/abc.cpp@@/main/1;usr1
when i grep the file.
$ grep "abc" myfile
[%XYZ12345%];/abc/abc.cpp@@/main/1;xyz
[%XYZ12345%];/abc/abc.cpp@@/main/2;usr2
[%XYZ2345%];/abc/abc.cpp@@/main/1;abc
[%XYZ98989%];/abc/abc.cpp@@/main/2;usr2
[%abc%];/abc/abc.cpp@@/main/1;usr1
but i want to grep the lines which are having [%abc%] string.
so my expected result is
[%abc%];/abc/abc.cpp@@/main/1;usr1
please help me to get the result.
Thanks in advance.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I have one txt file as bellow:
Inspector logging xxxxx xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx Inspector logging xxxxxxxxxxxxxx
xxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx Inspector loggingxxxxxxxxxxxxxxx
Inspector logging xxxxx xxxxxxxxxxxxxxxxxxxxxxxx
I want... (1 Reply)
Discussion started by: redlotus72
1 Replies
2. AIX
I am new to unix...
How to get all the saturdays of a specific year?
for a specific month, i tried as below..
cal 02 2006 | awk '{print $7}'
but it is not giving all saturdays....
can anyone help me with this?
Thanks in advance,
Sumi (9 Replies)
Discussion started by: sumi
9 Replies
3. UNIX for Advanced & Expert Users
PLEASE EXPLANIN ME...
sed 's~\(.*\)\(<name>\)\(.*\)\(</name>\)\(.*\)~\2\3\4~'
this is the format
<start><name>123<\name><addr>BAC<\addr><loc>sfo<\loc></start> (1 Reply)
Discussion started by: gksenthilkumar
1 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I am trying to understand a script and found a line as follows:
tr '\211\233\240' '\040' < $IN_FILE | tr -cd '\11\12\15\40-\176' > $TEMP_FILE
Can any one explain the above line .. What are they trying to translate using the tr command.. I have not used tr command.. so feeling little bit... (2 Replies)
Discussion started by: risshanth
2 Replies
5. Shell Programming and Scripting
shudnt this command :
grep test
give all the lines which do not hv 'C'. ^ wrks as negating character inside square brackets right ???
bt in my case grep is printin all the line in the file
also wht does
grep c+ test & grep c? test
shud do ??? (4 Replies)
Discussion started by: evergreen_cool
4 Replies
6. Shell Programming and Scripting
Hello,
I want to search for a file/directory named "abc" which is located anywhere in the given unix system.
I am using the command :-
But the problem is that this is giving me all combinations of files with have 'abc' in their name. But can I know the option to be used to get the location... (5 Replies)
Discussion started by: nsharath
5 Replies
7. Shell Programming and Scripting
Hi
I need to grep a particular world like and redirect into a temporary file .But while iam grepping some unwanted data are aslo coming like .ex In a FILE all these TABLENAMES are present .
module_table1,module_table2, module_table3,module_table5, module_table1_temp , module_table2_temp... (9 Replies)
Discussion started by: mani_isha
9 Replies
8. Shell Programming and Scripting
Hi,
What is the difference in capitalizing the option 'i' of xargs command, (i.e) xargs -i and xargs -I?
Also, what is the difference between the below 2 commands?
output_from_cmd | xargs -I {} grep '{}' file
output_from_cmd | xargs -I grep '{}' file
Any efficiency or performance... (4 Replies)
Discussion started by: royalibrahim
4 Replies
9. UNIX for Dummies Questions & Answers
dear users and experts,
i am stuck withis command and i am unable to understand what is it doing??
ls -d * (7 Replies)
Discussion started by: seshank
7 Replies
10. Shell Programming and Scripting
Hi all,
I need to find the line by using grep command with the two occurence of word in the same line. I tried the below example it prints the word choice.
cat nohup.out
Dictionary utl is completed.
file is completed.
Dictionary file is completed.
grep 'Dictionary\|file'... (0 Replies)
Discussion started by: arun888
0 Replies
LEARN ABOUT DEBIAN
fs_whereis
FS_WHEREIS(1) AFS Command Reference FS_WHEREIS(1)
NAME
fs_whereis - Reports each file server housing a file or directory
SYNOPSIS
fs whereis [-path <dir/file path>+] [-help]
fs whe [-p <dir/file path>+] [-h]
DESCRIPTION
The fs whereis command returns the name of each file server machine that houses the volume containing each directory or file named by the
-path argument.
OPTIONS
-path <dir/file path>+
Names each AFS file or directory for which to return the host file server machine. Partial pathnames are interpreted relative to the
current working directory, which is also the default value if this argument is omitted.
-help
Prints the online help for this command. All other valid options are ignored.
OUTPUT
The output includes a line for each specified directory or file. It names the file server machine on which the volume that houses the
specified directory or file resides. A list of multiple machines indicates that the directory or file is in a replicated volume.
Machine names usually have a suffix indicating their cell membership. If the cell is not clear, use the fs whichcell command to display the
cell in which the directory or file resides. To display the cell membership of the local machine, use the fs wscell command.
EXAMPLES
The following example indicates that volume housing the directory /afs/abc.com resides is replicated on both "fs1.abc.com" and
"fs3.abc.com":
% fs whereis -path /afs/abc.com
File /afs/abc.com is on hosts fs1.abc.com fs3.abc.com
PRIVILEGE REQUIRED
None
SEE ALSO
fs_whichcell(1), fs_wscell(1)
COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.
This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas
Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.
OpenAFS 2012-03-26 FS_WHEREIS(1)