Sadly the awk way still returns empty
so i tried this:
now I know that I cannot just use $ to pass shell variables into awk, and the above does not work, how can I pass var1 into the awk?
ideally this what I want to do, "on the last line, change the second field to 0"
---------- Post updated at 12:43 PM ---------- Previous update was at 12:41 PM ----------
you got me very confused here...
this what I tried after your reply:
I dont just want to print the second field of the last line, I want to change it to 0, my problem is END does not work as for some reason it thinks the last line is empty
now what it does is changing everything to 0 infinetly...
Last edited by TasosARISFC; 03-14-2011 at 02:16 PM..
Reason: more info
im trying to get
awk to print the string between 3rd and 4th backslashs to end of line
test could be any word
this
http://example.com/test/ >to this
http://example.com/test/ > testalso the other way round insert string at end of line... (13 Replies)
I am trying to use awk to identify and print out records in fields that are empty along with which line they are in. I hope the awk below is close, it runs but nothing results. Thank you :).
awk
awk -F'\t' 'FNR==NR ~ /^*$/ { print "NR is empty" }' file
file
123 GOOD ID 45... (3 Replies)
Hi, could you please help with the following:
I have an input file like:
one
two
three
four
five
six
I want to print the lines starting from 'three' to the empty line.
Something like that:
if ( line == "three" )
{
while ( !line.empty() )
{
cout <<... (0 Replies)
Hi all,
I need help figuring out why my script won't work when envoked from web interface. First off, I'm fairly new to Linux and Shell scripting so, my apologies for being ignorant!
So I have a python script that I envoke through a web interface. This script envokes my shell script and... (8 Replies)
Hello Team,
I have a script which will grep for a time from a file. I have following code to grep for a time in a file.
node=`hostname`
current_date=`date`
file11=weblogic.log
next_date=`date '+%b %e, %Y'`
next_date_time11=`grep -i "${#next_date}" ${file11}| tail -1 | awk... (3 Replies)
I am parsing a nagios config, searching for a string, and then printing the line 2 lines later (the "members" string). Here's the data:
define hostgroup{
hostgroup_name chat-dev
alias chat-dev
members thisisahostname
}
define hostgroup{
... (1 Reply)
I have multiple config files where I need to pull the ip address from loopback3. The format is the same in every file, the ip is the second line after interface loopback3.
interface loopback2 loopback
description router ID
ip address 192.168.1.1
interface loopback3 loopback
description... (3 Replies)
Hi folks,
I have a text file that I need to parse, and I cant figure it out. The source is a report breaking down softwares from various companies with some basic info about them (see source snippet below). Ultimately what I want is an excel sheet with only Adobe and Microsoft software name and... (5 Replies)