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)
Linux, C++, make, macro
In source code, we used some #ifdef macros. How can I enable #ifdef macro in the command line of "make" (NOTE: I do NOT want to change source code or makefile to define that macro from time to time).
e.g. test.cpp:
...
#ifdef TEST1
// code segment for test1
...... (3 Replies)
hi,
if i have a file and i want to search for the word error using grep, i usually want to see the surrounding lines too as they contain info about the error. what would be a nice way to achieve this?
thanks (6 Replies)
Hi All
I am getting this error when i try to run script from root using other user profile. Command I am running is
"su - user -c command"
Error envounterd
"then: then/endif not found"
Can any body please help me on this ... (4 Replies)
I am trying to use csh to do an if statement as below
if ( $tmaxf2 > $tmaxf1 ) then
set tmax = $tmaxf2
else
set tmax = $tmaxf1
endif
Does not work and I'm getting
if: Badly formed number. (0 Replies)
How unix file can be put in the hash table and how to write a program in which the chunk server acts as a client and server .
Can you give me a comprehensive idea of implementation. (0 Replies)
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)
Hi Guys,
I have a a bash script and i am exporting a variable in it.
I am calling a csh script from this bash script.
The variable "ABC" will be visible in csh script.
ks.bash
export ABC = abc
./kp.csh
ab.csh
echo $ABC
setenv ABC =cde (i want to assign this value to ABC only if... (4 Replies)
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
LEARN ABOUT OPENSOLARIS
unifdef
unifdef(1) User Commands unifdef(1)NAME
unifdef - resolve and remove ifdef'ed lines from C program source
SYNOPSIS
unifdef [-clt] [-Dname] [-Uname] [-iDname] [-iUname] ...
[filename]
DESCRIPTION
unifdef removes ifdefed lines from a file while otherwise leaving the file alone. It is smart enough to deal with the nested ifdefs, com-
ments, single and double quotes of C syntax, but it does not do any including or interpretation of macros. Neither does it strip out com-
ments, though it recognizes and ignores them. You specify which symbols you want defined with -D options, and which you want undefined with
-U options. Lines within those ifdefs will be copied to the output, or removed, as appropriate. Any ifdef, ifndef, else, and endif lines
associated with filename will also be removed.
ifdefs involving symbols you do not specify are untouched and copied out along with their associated ifdef, else, and endiff1 lines.
If an ifdefX occurs nested inside another ifdefX, then the inside ifdef is treated as if it were an unrecognized symbol. If the same symbol
appears in more than one argument, only the first occurrence is significant.
unifdef copies its output to the standard output and will take its input from the standard input if no filename argument is given.
OPTIONS
The following options are supported:
-c Complement the normal operation. Lines that would have been removed or blanked are retained, and vice versa.
-l Replace ``lines removed'' lines with blank lines.
-t Plain text option. unifdef refrains from attempting to recognize comments and single and double quotes.
-Dname Lines associated with the defined symbol name.
-Uname Lines associated with the undefined symbol name.
-iDname Ignore, but print out, lines associated with the defined symbol name. If you use ifdefs to delimit non-C lines, such as comments
or code which is under construction, then you must tell unifdef which symbols are used for that purpose so that it will not try
to parse for quotes and comments within them.
-iUname Ignore, but print out, lines associated with the undefined symbol name.
EXIT STATUS
The following exit values are returned:
0 Successful operation.
1 Operation failed.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWbtool |
+-----------------------------+-----------------------------+
SEE ALSO diff(1), attributes(5)DIAGNOSTICS
Premature EOF Inappropriate else or endif.
SunOS 5.11 14 Jan 1992 unifdef(1)