The description you have provided is a little sparse. If this is C or C++ code, the following two options might help:
For the example shown, you could search for lines starting with arbitrary whitespace followed by printf( as the start line and continue to the next line ending with ); followed by arbitrary whitespace.
If you're in vi at the start of the line containing printf you could use the % command to find the ending ) (assuming that the format string and any string constants being printed don't contain any mismatched parentheses).
If you're not already inside an editor making changes to your source code, you could use ed, ex, sed, or awk, to make similar changes (assuming you want to comment out ALL printf statements or only want to comment out printf statements with a specific format string).
But, if this is awk code (where the trailing semicolon is optional and in come cases the parentheses are also optional), different rules would be needed.
I have a lot of c code like this. I just put in a ridiculous amount of printf statements for debugging and I want to comment all of them out except the ones that contain "ACCEPT" and "REJECT"
TAKE A LOOK AT THE ATTACHED PICTURE.
my goal is just to SELECT n DELETE Those lines :
Dialogue: Marked=0,0:02:39.49,0:02:40.49,Default,NTP,0000,00 00,0000,!Effect,
(without the text)
take a look at that picture... the marked line...
i just need ALL of these lines removed.. i managed... (3 Replies)
{for(i in b){if(b-1&&a!=b){print i";\t\t"b}else{print "NEW:"i";\t\t"b} } }
what I need is to just print
else{print "NEW:"i";\t\t"b
and not print
{print i";\t\t"b}
how do i get awk to not print the first bit? is there an ignore statement although i still need awk to use this statement... (2 Replies)
Hi,
I am new to awk and trying to extract some specific fields from the a large file. Can you please help me to write gawk code displaying the out put in the below format:
Desired Output:
name fallback_ip member member
www-trymps.extlb.plstry.com-pool-1 180.254.112.50 ... (4 Replies)
Hi,
Request your help in getting help with the below text formatting using awk. I am still learning awk and your help here is appreciated. Thanks in advance.
Desireoutput
----------------
Virtual Pool Destination Profile Profile Profile Profile
1. virtual-1 pool-1 212.254.110.174:https... (2 Replies)
Hello,
I want extract multi values from multi url source to a csv text. Thank you very much for help.
my curl code : curl "http://www.web.com/cities//city.html
Source code:
div class="clear"></div>
<table class="listing-details">
<tr>
... (1 Reply)
Hi Guru's.
I am trying to use to check if $5 is greater than 80 & if not 100, then to print $0 :
awk '{ if ($5>80) && if ($5 != 100) print $0}
But getting error:
>bdf1|sed 's/%//g'|awk '{ if ($5>80) && if ($5 != 100) print $0}'
syntax error The source line is 1.
The error... (6 Replies)
Greetings Experts,
I do have some basic knowledge of Unix. The task I am trying to do through shell script is to generate the view script for all of the tables which is in YYYYMMDD format (I assume I am on Ksh).
I have certain tables that ends in YYYYMMDD format (eg: tbl_20150630)
For each... (1 Reply)
I need to pickup values provided in braces from a file with many records
I am able to get the count of number of dept's in each line .How do we write a logic to generate a print statement like below instead of using a while loop
if the count is 0 it should generate awk -F'' '{print $2 }' ... (1 Reply)
Hello Forum,
I'm looking to expand the following command:
INACTIVE_KERNELS=$(python -mplatform | grep -qi red && rpm -qa | grep '^kernel-' |grep -vE `uname -r` | paste -sd \; || echo "Not Red Hat Server")
Currently this command will check if my server is RedHat server using the grep -qi... (6 Replies)