07-20-2008
oops, I missed those. thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I would like to be able to grep (or some such thing) a search argument and then display the line plus the preceding 3 lines of the file and the following 3 lines of the file. Any ideas? Thanks in advance! :D (3 Replies)
Discussion started by: robster
3 Replies
2. UNIX for Dummies Questions & Answers
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
3. Shell Programming and Scripting
Well I have a 3000 lines result log file that contains all the machine data when it does the testing... It has 3 different section that i am intrsted in
1) starting with "20071126 11:11:11 Machine Header 1"
1000 lines...
"End machine header 1"
2) starting with "20071126 12:12:12 Machine... (5 Replies)
Discussion started by: vikas.iet
5 Replies
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
hi,
if I grep a file, sometimes I want to see as an eg 2 lines above and below my grep results.
how can this be done
thanks (3 Replies)
Discussion started by: JamesByars
3 Replies
6. Solaris
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
7. UNIX for Dummies Questions & Answers
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
8. Shell Programming and Scripting
I was wondering if it was possible to grep a pattern based on the surround text. For example, if i have an input file like this:
titleA
titleB
titlex
titleC
titleD
titlex
titleE
And I want to grep "title" and save the results only if it is not followed with a "titlex". My output... (14 Replies)
Discussion started by: jl487
14 Replies
9. Shell Programming and Scripting
Hi I would appreciate your help with this.
I have a output file from a command. It is broken based on initial of the users. Exmaple of iitials MN & SS. Under each section there is information pertaining to the user however each section can have different number of lines. MY challenge is to ... (5 Replies)
Discussion started by: mnassiri
5 Replies
10. Shell Programming and Scripting
Hello,
I am trying to grep search a pattern and a line before it.
cat input
>record1
hello1hello2hellonhello3
>record2
helloohello1hello2hello3
When I use, grep with -o option and either of -A/B/C options, I still can't see lines before or after the pattern. But the exact pattern is... (5 Replies)
Discussion started by: jacobs.smith
5 Replies
mkstr(1) General Commands Manual mkstr(1)
Name
mkstr - create an error message file
Syntax
mkstr [-] messagefile prefix file...
Description
The command is used to create files of error messages. Its use can make programs with large numbers of error diagnostics much smaller, and
reduce system overhead in running the program as the error messages do not have to be constantly swapped in and out.
The command will process each of the specified files, placing a massaged version of the input file in a file whose name consists of the
specified prefix and the original name. A typical usage of would be:
mkstr pistrings xx *.c
This command would cause all the error messages from the C source files in the current directory to be placed in the file pistrings and
processed copies of the source for these files to be placed in files whose names are prefixed with xx.
To process the error messages in the source to the message file keys on the string `error("' in the input stream. Each time it occurs, the
C string starting at the `"' is placed in the message file followed by a null character and a new-line character. The null character ter-
minates the message so it can be easily used when retrieved, the new-line character makes it possible to sensibly the error message file to
see its contents. The massaged copy of the input file then contains a pointer into the file which can be used to retrieve the message,
that is:
char filename[] = "/usr/lib/pi_strings";
int file = -1;
error(a1, a2, a3, a4)
{
char buf[256];
Bif (efil < 0) {
efil = open(efilname, 0);
if (efil < 0) {
oops:
perror(efilname);
exit(2);
}
}
if (lseek(efil, (long) a1, 0) || read(efil, buf, 256) <= 0)
goto oops;
printf(buf, a2, a3, a4);
}
Options
- Places error messages at the end of specified message file.
See Also
xstr(1), lseek(2)
mkstr(1)