Search the web
Sign In
New User? Sign Up
geeksthatgawk · for GNU Awk questions & discussions
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 190 - 220 of 221   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#220 From: Ambrosio Berdijo <aberdijo@...>
Date: Thu Mar 22, 2007 3:47 am
Subject: Re: [Geeks that Gawk] Arry values not visible
aberdijo
Offline Offline
Send Email Send Email
 
Hi Kaushik,

Try removing the "$" in ALL the array references,
for example:       my_Array[$arr_Index] becomes       my_Array[arr_Index]

Ambo

The bit of code I'm using to do this operation is as under -

awk -F"-!-" 'BEGIN{ TotalAlarms=0; InvalidAlarms=0;
OutstandingAlarms=0; TerminatedAlarms=0; AcknowledgedAlarms=0 }
/\/,/\/ {}
/^/ { arr_Index = 0 }
{

    if ( $0 !~ /^/ && $0 !~ /^/ )
    {
       #printf "Line : %s\n", $0
       #count = split ($0,Array,"-!-")
       my_Array[$arr_Index]=sprintf("%s",$0)
       printf ("-- Array %s : @ %d \n",my_Array[$arr_Index],arr_Index )
       arr_Index++
    }

    if ( $0 ~ // )
    {
       print "Hope to see something in the array\n"
       for ( i=0; i <= arr_Index; i++ )
       {
          printf ("Array Here @ %d is %s \n",i,my_Array[$i] )
       }
    }
}' /tmp/Recordfile

I'm unable to print the values stored in the array in the print statement

if ( $0 ~ // )
    {
       print "Hope to see something in the array\n"
       for ( i=0; i <= arr_Index; i++ )
       {
          printf ("Array Here @ %d is %s \n",i,my_Array[$i] )
       }
    }

Can someone please help.

Thanks and regards
Kaushik





---------------------------------
Looking for earth-friendly autos?
  Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.

[Non-text portions of this message have been removed]

#219 From: "kaushik_908" <kaushik_908@...>
Date: Mon Mar 12, 2007 1:35 pm
Subject: Arry values not visible
kaushik_908
Offline Offline
Send Email Send Email
 
Hi All,

I'm trying to read a file which looks as below ( There are thousands
of these records in the file )-

<BEGINREC>
ID -!- 359494
-!- ST -!- Outstanding
-!- MO -!- OSI_SYSTEM nuncp-tns_ns:.nuncp-temip_osilocal TESTOBJ "vtet"
-!- TE -!- { nuNCASNetwork nuncp-tns_ns:.nuncas  }
-!- AT -!- CommunicationsAlarm
-!- ET -!- Tue, Mar 6, 2007 08:00:14 AM
-!- PC -!- TransmissionError
-!- PS -!- Critical
-!- ADT -!- "VTET: VTET Run failed."
<ENDREC>

<BEGINREC>
ID -!- 359493
-!- ST -!- Outstanding
-!- MO -!- OSI_SYSTEM nuncp-tns_ns:.nuncp-temip_osilocal TESTOBJ "vtet"
-!- TE -!- { nuNCASNetwork nuncp-tns_ns:.nuncas  }
-!- AT -!- ProcessingErrorAlarm
-!- ET -!- Tue, Mar 6, 2007 08:00:03 AM
-!- PC -!- PerformanceDegraded
-!- PS -!- Indeterminate
-!- ADT -!- "VTET Another instance is already Running;A VTET process
is already running."
<ENDREC>

<BEGINREC>
ID -!- 359492
-!- ST -!- Outstanding
-!- MO -!- OSI_SYSTEM nuncp-tns_ns:.nuncp-temip_osilocal TESTOBJ "vtet"
-!- TE -!- { nuNCASNetwork nuncp-tns_ns:.nuncas  }
-!- AT -!- CommunicationsAlarm
-!- ET -!- Tue, Mar 6, 2007 03:00:14 AM
-!- PC -!- TransmissionError
-!- PS -!- Critical
-!- ADT -!- "VTET: VTET Run failed."
<ENDREC>

I'm trying to populate each element of the array my_array with a
single line in the file b/w the <BEGINREC> & <ENDREC> record delimiters.
my_array[0]= ID -!- 359494
my_array[1]= -!- ST -!- Outstanding
.
.
.


The bit of code I'm using to do this operation is as under -

awk -F"-!-" 'BEGIN{ TotalAlarms=0; InvalidAlarms=0;
OutstandingAlarms=0; TerminatedAlarms=0; AcknowledgedAlarms=0 }
/\<BEGINREC\>/,/\<ENDREC\>/ {}
/^<BEGINREC>/ { arr_Index = 0 }
{

    if ( $0 !~ /^<ENDREC>/ && $0 !~ /^<BEGINREC>/ )
    {
       #printf "Line : %s\n", $0
       #count = split ($0,Array,"-!-")
       my_Array[$arr_Index]=sprintf("%s",$0)
       printf ("-- Array %s : @ %d \n",my_Array[$arr_Index],arr_Index )
       arr_Index++
    }

    if ( $0 ~ /<ENDREC>/ )
    {
       print "Hope to see something in the array\n"
       for ( i=0; i <= arr_Index; i++ )
       {
          printf ("Array Here @ %d is %s \n",i,my_Array[$i] )
       }
    }
}' /tmp/Recordfile

I'm unable to print the values stored in the array in the print statement

if ( $0 ~ /<ENDREC>/ )
    {
       print "Hope to see something in the array\n"
       for ( i=0; i <= arr_Index; i++ )
       {
          printf ("Array Here @ %d is %s \n",i,my_Array[$i] )
       }
    }

Can someone please help.

Thanks and regards
Kaushik

#218 From: kaushik BR <kaushik_908@...>
Date: Mon Mar 12, 2007 1:32 pm
Subject: Unable to deliver your message
kaushik_908
Offline Offline
Send Email Send Email
 
Hi All,

I'm trying to read a file which looks as below ( There are thousands of these
records in the file )-

<BEGINREC>
ID -!- 359494
  -!- ST -!- Outstanding
  -!- MO -!- OSI_SYSTEM nuncp-tns_ns:.nuncp-temip_osilocal TESTOBJ "vtet"
  -!- TE -!- { nuNCASNetwork nuncp-tns_ns:.nuncas  }
  -!- AT -!- CommunicationsAlarm
  -!- ET -!- Tue, Mar 6, 2007 08:00:14 AM
  -!- PC -!- TransmissionError
  -!- PS -!- Critical
  -!- ADT -!- "VTET: VTET Run failed."
  <ENDREC>

<BEGINREC>
ID -!- 359493
  -!- ST -!- Outstanding
  -!- MO -!- OSI_SYSTEM nuncp-tns_ns:.nuncp-temip_osilocal TESTOBJ "vtet"
  -!- TE -!- { nuNCASNetwork nuncp-tns_ns:.nuncas  }
  -!- AT -!- ProcessingErrorAlarm
  -!- ET -!- Tue, Mar 6, 2007 08:00:03 AM
  -!- PC -!-
  PerformanceDegraded
  -!- PS -!- Indeterminate
  -!- ADT -!- "VTET Another instance is already Running;A VTET process is already
running."
  <ENDREC>

<BEGINREC>
ID -!- 359492
  -!- ST -!- Outstanding
  -!- MO -!- OSI_SYSTEM nuncp-tns_ns:.nuncp-temip_osilocal TESTOBJ "vtet"
  -!- TE -!- { nuNCASNetwork nuncp-tns_ns:.nuncas  }
  -!- AT -!- CommunicationsAlarm
  -!- ET -!- Tue, Mar 6, 2007 03:00:14 AM
  -!- PC -!- TransmissionError
  -!- PS -!- Critical
  -!- ADT -!- "VTET: VTET Run failed."
  <ENDREC>

I'm
trying to populate each element of the array my_array with a single line in the
file b/w the <BEGINREC> & <ENDREC> record delimiters.
my_array[0]= ID -!- 359494
my_array[1]= -!- ST -!- Outstanding
.
.
.


The bit of code I'm using to do this operation is as under -

awk
-F"-!-" 'BEGIN{ TotalAlarms=0; InvalidAlarms=0; OutstandingAlarms=0;
TerminatedAlarms=0; AcknowledgedAlarms=0 }
/\<BEGINREC\>/,/\<ENDREC\>/ {}
/^<BEGINREC>/ { arr_Index = 0 }
{

     if ( $0 !~ /^<ENDREC>/ && $0 !~ /^<BEGINREC>/ )
     {
        #printf "Line : %s\n", $0
        #count = split ($0,Array,"-!-")
        my_Array[$arr_Index]=sprintf("%s",$0)
        printf ("-- Array %s : @ %d \n",my_Array[$arr_Index],arr_Index )
        arr_Index++
     }

     if ( $0 ~ /<ENDREC>/ )
     {
        print "Hope to see something in the array\n"
        for ( i=0; i <= arr_Index; i++ )
        {
           printf ("Array Here @ %d is %s \n",i,my_Array[$i] )
        }
     }
}' /tmp/Recordfile

I'm unable to print the values stored in the array in the print
  statement

if ( $0 ~ /<ENDREC>/ )
     {
        print "Hope to see something in the array\n"
        for ( i=0; i <= arr_Index; i++ )
        {
           printf ("Array Here @ %d is %s \n",i,my_Array[$i] )
        }
     }

Can someone please help.

Thanks and regards
Kaushik









________________________________________________________________________________\
____
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

[Non-text portions of this message have been removed]

#217 From: "goodmis" <mr_4gl@...>
Date: Mon Feb 5, 2007 11:15 pm
Subject: How does Awk Handle Open Files?
goodmis
Offline Offline
Send Email Send Email
 
How does awk handle open files?  Suppose I am running a cron job to
find files that are downloaded to a directory via sftp.  Every 10
minutes, I want to process the files using an awk script and move them
to another directory.  What would happen if the awk script was fired
and the file was not finished downloading?

Would awk handle it gracefully or would I have to account for it in a
unix script?

Thanks

Any assistance would be greatly appreciated

*/10 * * * * /bin/process_sun.sh > /dev/null 2>&1

for FILE in `find /home/Upload/* -prune -type f -newer TIMEFILE`
do
  gawk -f convert_sunterra.awk $FILE
done

#216 From: Ambrosio Berdijo <aberdijo@...>
Date: Fri Sep 22, 2006 1:54 am
Subject: Re: [Geeks that Gawk] creating a new file from old one using awk
aberdijo
Offline Offline
Send Email Send Email
 
The algorithm below works best if the file is already pre-sorted based on the
Account Code, so using gawk win32 and gsort win32...

assume test.txt contains:
12345,89
78777,89
56789,40

run gawk -F, "{print $2 \" \" $1}" test.txt | gsort -T. > newtest.txt
then newtest.txt would contain:
40 56789
89 12345
89 12345

Try this out first, I think gsort would have problems sorting account code "200"
& "2000" but at least all data is grouped together by account codes. Then run
the algo below (just swap $2 & $1 in the algo's description)








Albert Bickford <bickford@...> wrote: Read the file with Gawk a line at a
time. Set comma as the field separator.

On each line, look at the second field. If it is an account number that
you haven't seen before, then (i.e., if $2 <> PrevAcctNum)
     If this isn't the first account you've seen:
         output the line "NUMBER OF ACCTS WITH CODE" PrevAcctNum ": "
AcctCount
         reset AcctCount to zero
     output the header line: "ACCTS WITH CODE " $2
     Remember what the current account number is (for comparison with the
next line): PrevAcctNum = $2
Then, for each line:
     print the first field ($1)
     increment the AcctCount
And (important), at the end of the file, output the line "NUMBER OF
ACCTS WITH CODE" PrevAcctNum ": " AcctCount  for the last group.

This doesn't cover all the details, but it is the general idea. I hope
you can take it from there.

Albert

Femi George [ MTN - Golden Plaza ] wrote:
> i have the following file;
>
> 12345,89
> 78777,89
> 56789,40
> 18978,40
> 98864,40
> 21378,41
>
> i want to create a different file like this;
>
> ACCTS WITH CODE 89
> 12345
> 78777
> NUMBER OF ACCTS WITH CODE 89: 2
> ACCTS WITH CODE 40
> 56789
> 18978
> 98864
> NUMBER OF ACCTS WITH CODE 40: 3
> ACCTS WITH CODE 41
> 21378
> NUMBER OF ACCTS WITH CODE 41: 1
>
> how can i do this please?
> thanks
>
> http://www.mtnonline.com/contact/disclaimer.asp
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>
>



Yahoo! Groups Links













---------------------------------
Do you Yahoo!?
  Get on board. You're invited to try the new Yahoo! Mail.

[Non-text portions of this message have been removed]

#215 From: Albert Bickford <bickford@...>
Date: Fri Sep 22, 2006 1:29 am
Subject: Re: [Geeks that Gawk] creating a new file from old one using awk
albert_bickford
Offline Offline
Send Email Send Email
 
Read the file with Gawk a line at a time. Set comma as the field separator.

On each line, look at the second field. If it is an account number that
you haven't seen before, then (i.e., if $2 <> PrevAcctNum)
     If this isn't the first account you've seen:
         output the line "NUMBER OF ACCTS WITH CODE" PrevAcctNum ": "
AcctCount
         reset AcctCount to zero
     output the header line: "ACCTS WITH CODE " $2
     Remember what the current account number is (for comparison with the
next line): PrevAcctNum = $2
Then, for each line:
     print the first field ($1)
     increment the AcctCount
And (important), at the end of the file, output the line "NUMBER OF
ACCTS WITH CODE" PrevAcctNum ": " AcctCount  for the last group.

This doesn't cover all the details, but it is the general idea. I hope
you can take it from there.

Albert

Femi George [ MTN - Golden Plaza ] wrote:
> i have the following file;
>
> 12345,89
> 78777,89
> 56789,40
> 18978,40
> 98864,40
> 21378,41
>
> i want to create a different file like this;
>
> ACCTS WITH CODE 89
> 12345
> 78777
> NUMBER OF ACCTS WITH CODE 89: 2
> ACCTS WITH CODE 40
> 56789
> 18978
> 98864
> NUMBER OF ACCTS WITH CODE 40: 3
> ACCTS WITH CODE 41
> 21378
> NUMBER OF ACCTS WITH CODE 41: 1
>
> how can i do this please?
> thanks
>
> http://www.mtnonline.com/contact/disclaimer.asp
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>
>

#214 From: "Femi George [ MTN - Golden Plaza ]" <FemiG@...>
Date: Thu Sep 21, 2006 5:47 pm
Subject: creating a new file from old one using awk
gnuts4lunch
Offline Offline
Send Email Send Email
 
i have the following file;

12345,89
78777,89
56789,40
18978,40
98864,40
21378,41

i want to create a different file like this;

ACCTS WITH CODE 89
12345
78777
NUMBER OF ACCTS WITH CODE 89: 2
ACCTS WITH CODE 40
56789
18978
98864
NUMBER OF ACCTS WITH CODE 40: 3
ACCTS WITH CODE 41
21378
NUMBER OF ACCTS WITH CODE 41: 1

how can i do this please?
thanks

http://www.mtnonline.com/contact/disclaimer.asp


[Non-text portions of this message have been removed]

#213 From: "Daniel Ajoy" <da.ajoy@...>
Date: Fri Sep 8, 2006 1:45 pm
Subject: Re: [Geeks that Gawk] can we call awkscript from a webbrowser
daniel_ajoy
Offline Offline
Send Email Send Email
 
I don't understand what you mean. Ask the group.

Daniel


On 8 Sep 2006 at 10:43, chs.chakrapani wrote:

>
> Helo Daniel
>
> One more doubt from chakrapani,
>
> I have a file which contains
>
> key no(10numeric characters) name (20 chars) address(40chars)
>
> now the doubt in name some mistake is with key no value 1234567890
>
> I want to access the file with this key value interactively and change
> the name value as we required in the same file with out redirecting the
> output to another and replacing that file later is it possible?
>
> one more
>
> can we show the processing bar in awk script?
>
> Don't feel rubbish with this small doubts I am a new entry in awking
> programming?
> But I can do all these thing in COBOL programming?
>
> Thanks in advance
>
> Srinivas Chakrapani
>

#212 From: "Daniel Ajoy" <da.ajoy@...>
Date: Thu Sep 7, 2006 6:39 pm
Subject: RE: [Geeks that Gawk] can we call awkscript from a webbrowser
daniel_ajoy
Offline Offline
Send Email Send Email
 
On 7 Sep 2006 at 8:19, Stout, Danny wrote:

> Where "comma.awk" would be the filename of the below script.
>
> =======

{
	 while (1) {
		 new = gensub(/(.*[0-9])([0-9]{3})/,"\\1,\\2",1)
		 if ($0 == new) break
		 $0 = new
	 }
	 print
}




echo hello 12123456 wewr | gawk --re-interval -f commas.awk

hello 12,123,456 wewr



Daniel

#211 From: "Daniel Ajoy" <da.ajoy@...>
Date: Thu Sep 7, 2006 1:31 pm
Subject: Re: [Geeks that Gawk] can we call awkscript from a webbrowser
daniel_ajoy
Offline Offline
Send Email Send Email
 
On 7 Sep 2006 at 5:14, schpanich wrote:

> Hello friends,
> My name is Srinivas Chakrpani, I have so many doubts in awk scripting.
> The scripting tools like perl,php,python can call from a web browser.
> Just by modification the Add-Handler types in httpd.conf file (for
> apache web server). Is it possible in the same way we can call any
> awkscript from the webserver. If so please give the details what we
> have to do to the file/ permissions to files and with a example script.

the awk file has to be executable

in httpd.conf :

<IfModule mod_mime.c>
...
AddHandler cgi-script awk
...
</IfModule>


The file index.awk
starts with

#!/bin/gawk -f


> Moreover I want to format the numbers in awk that is
> 123456 as 1,23,456 how is it possible if possible please share me with
> a example

echo 123456 | gawk '{print gensub(/(.)(..)(...)/,"\\1,\\2,\\3",1)}'
1,23,456

> I want access multiple files in awk is it possible?

while((getline < "file1") > 0) {
	 ...
}
close("file1")

while((getline < "file2") > 0) {
	 ...
}
close("file2")

> Any scripts in awk are please send to my mail address giving below



Daniel

#210 From: "Stout, Danny" <danny.stout@...>
Date: Thu Sep 7, 2006 1:19 pm
Subject: RE: [Geeks that Gawk] can we call awkscript from a webbrowser
dasthcc
Offline Offline
Send Email Send Email
 
Srinivas,

   Here is an awk script I wrote some time ago for adding commas (every 3
digits) into a number.  Command line format would be something like:
echo 1234567 | awk -f comma.awk

     Where "comma.awk" would be the filename of the below script.



=======



#

#   awk program to add commas in a number every 3 digits

#

{

   # ... save off the number

   num = $1 ;

   # ... get length of the number entered

   lng = length($1) ;



   # ... determine the number of commas that needs to be added to the
number entered

   commas = int(lng/3) ;



   # ... determine number of remaining numbers (modulo arithmetic)

   lose1 = lng % 3 ;



   # ... no remaining numbers AND number needs at least ONE comma then

   # ...    subtract one from comma count before we start

   if (( ! lose1 ) && ( commas > 0 ))

   {

     commas -= 1 ;

   }



   # ... initialize the string variable to an empty string

   num = "" ;



   for( x = 1 ; x <= commas ; x++ )

   {

     # ... add 3 to a loop counter

     y += 3



     # ... starting at the end of the number, strip off 3 chars at a time

     get = substr($1,lng-y+1,3) ;



     if ( x == 1 )

     {

       num = get ;

     }

     else

     {

       # ... add a comma to the string

       num = get "," num ;

     }

   }



   # ... if have less than another set of 3 numbers, then

   # ...   add what's left of the number to the front

   rest = lng - (commas * 3 )



   if ( rest > 0 )

   {

     # ... if number was shorter than 3 chars then print it without comma

     if(lng>3)

     {

       get = substr($1,1,rest) ;

       num = get "," num ;

     }

     else

     {

       num = substr($1,1,rest) ;

     }

   }

   print num ;

}



   Sorry, but can't help with the rest of your request, beyond my skill
set right now.



Good luck,

dan



________________________________

From: geeksthatgawk@yahoogroups.com
[mailto:geeksthatgawk@yahoogroups.com] On Behalf Of schpanich
Sent: Thursday, September 07, 2006 12:14 AM
To: geeksthatgawk@yahoogroups.com
Subject: [Geeks that Gawk] can we call awkscript from a webbrowser



Hello friends,
My name is Srinivas Chakrpani, I have so many doubts in awk scripting.
The scripting tools like perl,php,python can call from a web browser.
Just by modification the Add-Handler types in httpd.conf file (for
apache web server). Is it possible in the same way we can call any
awkscript from the webserver. If so please give the details what we
have to do to the file/ permissions to files and with a example script.

Moreover I want to format the numbers in awk that is
123456 as 1,23,456 how is it possible if possible please share me with
a example

I want access multiple files in awk is it possible?

Any scripts in awk are please send to my mail address giving below

chs.chakrapani@... <mailto:chs.chakrapani%40licindia.com>




This email may contain confidential and privileged material for the sole use of
the intended recipient(s) and only for those purposes previously or herein
authorized by the sender. Any review, use, distribution or disclosure by others,
or use by the recipient for unauthorized purposes, is strictly prohibited. If
you are not the intended recipient (or authorized to receive for the recipient),
please contact the sender by reply email and delete all copies of this message.

Disclaimer:
This email may contain confidential and privileged material for the sole use of
the intended recipient(s) and only for those purposes previously or herein
authorized by the sender. Any review, use, distribution or disclosure by others,
or use by the recipient for unauthorized purposes, is strictly prohibited. If
you are not the intended recipient (or authorized to receive for the recipient),
please contact the sender by reply email and delete all copies of this message.


[Non-text portions of this message have been removed]

#209 From: schpanich
Date: Thu Sep 7, 2006 5:14 am
Subject: can we call awkscript from a webbrowser
schpanich
Offline Offline
 
Hello friends,
My name is Srinivas Chakrpani, I have so many doubts in awk scripting.
The scripting tools like perl,php,python can call from a web browser.
Just by modification the Add-Handler types in httpd.conf file (for
apache web server). Is it possible in the same way we can call any
awkscript from the webserver. If so please give the details what we
have to do to the file/ permissions to files and with a example script.

Moreover I want to format the numbers in awk that is
123456 as 1,23,456 how is it possible if possible please share me with
a example

I want access multiple files in awk is it possible?

Any scripts in awk are please send to my mail address giving below

chs.chakrapani@...

#208 From: "sdkfz1822002" <sdkfz1822002@...>
Date: Wed Aug 9, 2006 7:51 pm
Subject: java.lang.NoClassDefFoundError
sdkfz1822002
Offline Offline
Send Email Send Email
 
I'm trying to run a .tcl using wish which keeps giving me trouble.
This exception is apparently looking for a paticular class
(GenerateSQL in this case), but it follows up with an "Exception in
thread 'main". The classpath looks correct (based on another system
that the .tcl works on). GnuWin32 seems to be correctly installed and
listed on the classpath as well. -Any thoughts?

Some more of the excception:
Exception in thread "main" while executing
"exec java com.liebert.xml.GenerateSQL $filename $tablename.com"
("eval" body line 1)
invoked from within
"eval {exec java com.liebert.xml.GenerateSQL $filename $tablename >
$tablename.col}...

Thanks,
Dave Higgins
Columbus, Ohio

#207 From: ylng <naghems@...>
Date: Sun Aug 6, 2006 12:33 pm
Subject: RE: [Geeks that Gawk] mawk: print command with special characters?
naghems
Offline Offline
Send Email Send Email
 
Kindly help me anybody!!!! how to create an index file? pleeeeeeeeeeeeeeeeeese

Ambrosio Berdijo <aberdijo@...> wrote:                                 
Try this (use \\\")

  gawk "BEGIN {print \"\\\"hello\\\"\"}"
  "hello"

  I tested it on Windows XP running win32 port gawk 3.1.3
  from
(http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=16431

  Ambo

  "Stout, Danny" <danny.stout@...> wrote: Might try a Single Quote ( '
) or a backslash-Single Quote ( \' )... if
  that works you could use a Double Single Quote to give the illusion of a
  Double Quote maybe...   Just a thought.

  Good luck !!

  ________________________________

  From: geeksthatgawk@yahoogroups.com
  [mailto:geeksthatgawk@yahoogroups.com] On Behalf Of spillikinaerospace
  Sent: Tuesday, July 04, 2006 10:29 PM
  To: geeksthatgawk@yahoogroups.com
  Subject: [Geeks that Gawk] mawk: print command with special characters?

  Hi,
  can someone help me with this?
  i want the print command to print a double quote mark as part of a
  string. mawk won't have it. a double quote is a control character and
  mawk will be damned if it's gonna let me treat it like a regular
  character.

  i wanna change this:

  jack spratt could
  eat no fat

  to this:

  jack " spratt could
  eat " no fat

  and i wanna do it on the command line. something like this:

  mawk "{ print $1, [some expression that mawk will recognize as a
  quote], $2, $3}" input.txt > output.txt

  i've tried *everything*. \", \\", \\\", "\"", /\"/, \x22, "\x22" .....
  any combination you could possibly think of. i've read whatever
  references i could find. nothing works.

  anybody out there who's been there and done that?

  thanx, mike

  This email may contain confidential and privileged material for the sole use of
the intended recipient(s) and only for those purposes previously or herein
authorized by the sender. Any review, use, distribution or disclosure by others,
or use by the recipient for unauthorized purposes, is strictly prohibited. If
you are not the intended recipient (or authorized to receive for the recipient),
please contact the sender by reply email and delete all copies of this message.

  [Non-text portions of this message have been removed]

  Yahoo! Groups Links


  ---------------------------------
  Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2¢/min or less.

  [Non-text portions of this message have been removed]






  Nagaraj-~~~~~^



  __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

[Non-text portions of this message have been removed]

#206 From: ylng <naghems@...>
Date: Sat Jul 8, 2006 1:08 pm
Subject: Re: [Geeks that Gawk] mawk: print command with special characters?
naghems
Offline Offline
Send Email Send Email
 
Hi frenz

How to create index file in gawk? am unable to do this...... If I use sorting
and grepping it is taking lot of time. Please anybody help me.

and do tell me how to index?


spillikinaerospace <spillikinaerospace@...> wrote:
thanx, but no luck yet

  >
  > Might try a Single Quote ( ' ) or a backslash-Single Quote ( \' )... if
  > that works you could use a Double Single Quote to give the illusion of a
  > Double Quote maybe...   Just a thought.






  Nagaraj-~~~~~^




---------------------------------
Want to be your own boss? Learn how on  Yahoo! Small Business.

[Non-text portions of this message have been removed]

#205 From: "spillikinaerospace" <spillikinaerospace@...>
Date: Fri Jul 7, 2006 4:11 am
Subject: Re: [Geeks that Gawk] mawk: print command with special characters?
spillikinaer...
Online Now Online Now
Send Email Send Email
 
>
> Mike... what would happen if you did a:
>
>             gawk "{print 'word' }"
>
BINGO!!! that did the trick. i suppose with mawk there's just alot of
guesswork involved. oh well, i got done what i wanted to get done.

thanks Danny

#204 From: "spillikinaerospace" <spillikinaerospace@...>
Date: Wed Jul 5, 2006 4:19 pm
Subject: Re: [Geeks that Gawk] mawk: print command with special characters?
spillikinaer...
Online Now Online Now
Send Email Send Email
 
thanx, but no luck yet

>
> Might try a Single Quote ( ' ) or a backslash-Single Quote ( \' )... if
> that works you could use a Double Single Quote to give the illusion of a
> Double Quote maybe...   Just a thought.

#203 From: "Stout, Danny" <danny.stout@...>
Date: Thu Jul 6, 2006 12:37 pm
Subject: RE: [Geeks that Gawk] mawk: print command with special characters?
dasthcc
Offline Offline
Send Email Send Email
 
Mike... what would happen if you did a:

             gawk "{print 'word' }"

                   or

             gawk "{print \"word\" }"



   (the idea being for the command line interpreter to know what double
quote belongs to IT and what quote belongs to the statement within the
command line)



Good luck,

danny



________________________________

From: geeksthatgawk@yahoogroups.com
[mailto:geeksthatgawk@yahoogroups.com] On Behalf Of spillikinaerospace
Sent: Wednesday, July 05, 2006 10:15 PM
To: geeksthatgawk@yahoogroups.com
Subject: Re: [Geeks that Gawk] mawk: print command with special
characters?



> Try this (use \\\")
>
> gawk "BEGIN {print \"\\\"hello\\\"\"}"
> "hello"

HASTA LA VISTA ***BABY***
that was my silver bullet! i tried variants on what you wrote and
finally stumbled on the solution:

i did:
mawk "{print $1, \"\\\"\"}"

and it did:
"

YES! i'm not gonna waste my time trying to decipher the logic of it,
just thank the Lord that it works. and it only takes 8 characters to
specify that one character!

now i have one more problem though. i want to print a literal string
constant. it won't do it:

i do:
mawk "{print "word"}"

and it does:

.... nothing! no errors, but no output either. am i doin something
wrong?

mike

BTW, i'm on 98se, mawk 1.22x




This email may contain confidential and privileged material for the sole use of
the intended recipient(s) and only for those purposes previously or herein
authorized by the sender. Any review, use, distribution or disclosure by others,
or use by the recipient for unauthorized purposes, is strictly prohibited. If
you are not the intended recipient (or authorized to receive for the recipient),
please contact the sender by reply email and delete all copies of this message.



[Non-text portions of this message have been removed]

#202 From: "spillikinaerospace" <spillikinaerospace@...>
Date: Thu Jul 6, 2006 3:14 am
Subject: Re: [Geeks that Gawk] mawk: print command with special characters?
spillikinaer...
Online Now Online Now
Send Email Send Email
 
> Try this (use \\\")
>
> gawk "BEGIN {print \"\\\"hello\\\"\"}"
> "hello"

HASTA LA VISTA ***BABY***
that was my silver bullet! i tried variants on what you wrote and
finally stumbled on the solution:

i did:
mawk "{print $1, \"\\\"\"}"

and it did:
"

YES! i'm not gonna waste my time trying to decipher the logic of it,
just thank the Lord that it works. and it only takes 8 characters to
specify that one character!

now i have one more problem though. i want to print a literal string
constant. it won't do it:

i do:
mawk "{print "word"}"

and it does:


.... nothing! no errors, but no output either. am i doin something wrong?

mike

BTW, i'm on 98se, mawk 1.22x

#201 From: Ambrosio Berdijo <aberdijo@...>
Date: Wed Jul 5, 2006 3:09 pm
Subject: RE: [Geeks that Gawk] mawk: print command with special characters?
aberdijo
Offline Offline
Send Email Send Email
 
Try this (use \\\")

gawk "BEGIN {print \"\\\"hello\\\"\"}"
"hello"

I tested it on Windows XP running win32 port gawk 3.1.3
from
(http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=16431

Ambo

"Stout, Danny" <danny.stout@...> wrote: Might try a Single Quote ( ' )
or a backslash-Single Quote ( \' )... if
that works you could use a Double Single Quote to give the illusion of a
Double Quote maybe...   Just a thought.



Good luck !!



________________________________

From: geeksthatgawk@yahoogroups.com
[mailto:geeksthatgawk@yahoogroups.com] On Behalf Of spillikinaerospace
Sent: Tuesday, July 04, 2006 10:29 PM
To: geeksthatgawk@yahoogroups.com
Subject: [Geeks that Gawk] mawk: print command with special characters?



Hi,
can someone help me with this?
i want the print command to print a double quote mark as part of a
string. mawk won't have it. a double quote is a control character and
mawk will be damned if it's gonna let me treat it like a regular
character.

i wanna change this:

jack spratt could
eat no fat

to this:

jack " spratt could
eat " no fat

and i wanna do it on the command line. something like this:

mawk "{ print $1, [some expression that mawk will recognize as a
quote], $2, $3}" input.txt > output.txt

i've tried *everything*. \", \\", \\\", "\"", /\"/, \x22, "\x22" .....
any combination you could possibly think of. i've read whatever
references i could find. nothing works.

anybody out there who's been there and done that?

thanx, mike




This email may contain confidential and privileged material for the sole use of
the intended recipient(s) and only for those purposes previously or herein
authorized by the sender. Any review, use, distribution or disclosure by others,
or use by the recipient for unauthorized purposes, is strictly prohibited. If
you are not the intended recipient (or authorized to receive for the recipient),
please contact the sender by reply email and delete all copies of this message.



[Non-text portions of this message have been removed]





Yahoo! Groups Links









---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2¢/min or less.

[Non-text portions of this message have been removed]

#200 From: "Stout, Danny" <danny.stout@...>
Date: Wed Jul 5, 2006 1:58 pm
Subject: RE: [Geeks that Gawk] mawk: print command with special characters?
dasthcc
Offline Offline
Send Email Send Email
 
Might try a Single Quote ( ' ) or a backslash-Single Quote ( \' )... if
that works you could use a Double Single Quote to give the illusion of a
Double Quote maybe...   Just a thought.



Good luck !!



________________________________

From: geeksthatgawk@yahoogroups.com
[mailto:geeksthatgawk@yahoogroups.com] On Behalf Of spillikinaerospace
Sent: Tuesday, July 04, 2006 10:29 PM
To: geeksthatgawk@yahoogroups.com
Subject: [Geeks that Gawk] mawk: print command with special characters?



Hi,
can someone help me with this?
i want the print command to print a double quote mark as part of a
string. mawk won't have it. a double quote is a control character and
mawk will be damned if it's gonna let me treat it like a regular
character.

i wanna change this:

jack spratt could
eat no fat

to this:

jack " spratt could
eat " no fat

and i wanna do it on the command line. something like this:

mawk "{ print $1, [some expression that mawk will recognize as a
quote], $2, $3}" input.txt > output.txt

i've tried *everything*. \", \\", \\\", "\"", /\"/, \x22, "\x22" .....
any combination you could possibly think of. i've read whatever
references i could find. nothing works.

anybody out there who's been there and done that?

thanx, mike




This email may contain confidential and privileged material for the sole use of
the intended recipient(s) and only for those purposes previously or herein
authorized by the sender. Any review, use, distribution or disclosure by others,
or use by the recipient for unauthorized purposes, is strictly prohibited. If
you are not the intended recipient (or authorized to receive for the recipient),
please contact the sender by reply email and delete all copies of this message.



[Non-text portions of this message have been removed]

#199 From: "spillikinaerospace" <spillikinaerospace@...>
Date: Wed Jul 5, 2006 3:28 am
Subject: mawk: print command with special characters?
spillikinaer...
Online Now Online Now
Send Email Send Email
 
Hi,
can someone help me with this?
i want the print command to print a double quote mark as part of a
string. mawk won't have it. a double quote is a control character and
mawk will be damned if it's gonna let me treat it like a regular
character.

i wanna change this:

jack spratt could
eat no fat

to this:

jack " spratt could
eat " no fat

and i wanna do it on the command line. something like this:

mawk "{ print $1, [some expression that mawk will recognize as a
quote], $2, $3}" input.txt > output.txt

i've tried *everything*. \", \\", \\\", "\"", /\"/, \x22, "\x22" .....
any combination you could possibly think of. i've read whatever
references i could find. nothing works.

anybody out there who's been there and done that?

thanx, mike

#198 From: delgado0m
Date: Fri Mar 10, 2006 11:15 pm
Subject: AWK for windows
delgado0m
Offline Offline
 
There is freeware for Windows at http://www.klabaster.com, if anyone is
interested.

#197 From: Dave Higgins <sdkfz1822002@...>
Date: Tue Feb 28, 2006 1:38 pm
Subject: Re: [Geeks that Gawk] "couldn't execute "gawk": no such file or directory while executing"
sdkfz1822002
Offline Offline
Send Email Send Email
 
Albert,
   Thank you. You're right. The issue seemed to be that the gnuwin32  wasn't in
the environment variables path. I appreciate the quick  response, too.

   Dave

Albert Bickford <bickford@...> wrote:          That particular error message
(I assume you mean the one in the subject
   line) could mean either that gawk could not find gawk itself, or the awk
   program ../formsql.awk, or the data file $filename. Check for the
   existence of all three just before executing the "eval" command and see
   which one is missing.

   Dave Higgins wrote:
   > Any ideas on what this is referring to or how to correct it?
   >
   >   It seems to be related to the following:
   >
   >   # 2/25/2005
   >   #
   >
   >   proc run {filename} {
   >       set base [file rootname $filename]
   >
   >       set as400 $base
   >       append as400 ".sql"
   >       set hsql $base
   >       append hsql "_hsql.sql"
   >       set insert $base
   >       append insert "_insert.java"
   >       set update $base
   >       append update "_update.java"
   >
   >       set arg [getNewFlag $base]
   >
   >       eval {exec gawk -v newtable=$arg -f ../formsql.awk $filename > $as400}
   >
   >   Thanks for any insight,
   >   Dave
   >
   > ---------------------------------
   >  Yahoo! Mail
   >  Use Photomail to share photos without annoying attachments.
   >
   > [Non-text portions of this message have been removed]
   >
   >
   >
   >
   >
   >
   >
   > Yahoo! Groups Links
   >
   >
   >
   >
   >
   >
   >
   >
   >
   >
   >



           SPONSORED LINKS
                                                         Basic programming
language                                          Computer programming languages
Programming languages
Java programming language

---------------------------------
     YAHOO! GROUPS LINKS


     Visit your group "geeksthatgawk" on the web.

     To unsubscribe from this group, send an email to:
  geeksthatgawk-unsubscribe@yahoogroups.com

     Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


---------------------------------




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

[Non-text portions of this message have been removed]

#196 From: Albert Bickford <bickford@...>
Date: Tue Feb 28, 2006 4:14 am
Subject: Re: [Geeks that Gawk] "couldn't execute "gawk": no such file or directory while executing"
albert_bickford
Offline Offline
Send Email Send Email
 
That particular error message (I assume you mean the one in the subject
line) could mean either that gawk could not find gawk itself, or the awk
program ../formsql.awk, or the data file $filename. Check for the
existence of all three just before executing the "eval" command and see
which one is missing.

Dave Higgins wrote:
> Any ideas on what this is referring to or how to correct it?
>
>   It seems to be related to the following:
>
>   # 2/25/2005
>   #
>
>   proc run {filename} {
>       set base [file rootname $filename]
>
>       set as400 $base
>       append as400 ".sql"
>       set hsql $base
>       append hsql "_hsql.sql"
>       set insert $base
>       append insert "_insert.java"
>       set update $base
>       append update "_update.java"
>
>       set arg [getNewFlag $base]
>
>       eval {exec gawk -v newtable=$arg -f ../formsql.awk $filename > $as400}
>
>   Thanks for any insight,
>   Dave
>
> ---------------------------------
>  Yahoo! Mail
>  Use Photomail to share photos without annoying attachments.
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>

#195 From: "sdkfz1822002" <sdkfz1822002@...>
Date: Mon Feb 27, 2006 4:09 pm
Subject: couldn't execute "gawk": no such file or directory while executing
sdkfz1822002
Offline Offline
Send Email Send Email
 
Any ideas on what this is referring to or how to correct it?

It seems to be related to the following:

proc run {filename} {
     set base [file rootname $filename]

     set as400 $base
     append as400 ".sql"
     set hsql $base
     append hsql "_hsql.sql"
     set insert $base
     append insert "_insert.java"
     set update $base
     append update "_update.java"

     set arg [getNewFlag $base]

     eval {exec gawk -v newtable=$arg -f ../formsql.awk $filename > $as400}

Thanks for any insight,
Dave

#193 From: "Stout, Danny" <danny.stout@...>
Date: Tue Dec 27, 2005 6:51 pm
Subject: RE: [Geeks that Gawk] Re: Help On awk
dasthcc
Offline Offline
Send Email Send Email
 
Sorry about the previous wrong example.  For GAWK the format is a little
bit different than the AWK format.  Here is the GAWK format:



gawk -F":" '{if($1 == ZZ) { print $6 }}' -v "ZZ=${username}" passwd.bak
>output



   If needed two arguments passed in you would have to give another   -v
preceeding the double-quote surrounded variable and it's value,  ie.,
"YY=12345" , ie. :



gawk -F":" '{if($1 == ZZ) { print $6 } ; if(YY == $4) { print $6 }}'  -v
"ZZ=${username}"  -v "YY=12345"  passwd.bak  >output



    You may want to put the script into a file (say filename "space.gwk"
) and try it like the below:



gawk -F":"  -f space.gwk -v "ZZ=${username}"  passwd.bak  >output







   _____

From: geeksthatgawk@yahoogroups.com
[mailto:geeksthatgawk@yahoogroups.com] On Behalf Of Stout, Danny
Sent: Tuesday, December 27, 2005 7:55 AM
To: geeksthatgawk@yahoogroups.com
Subject: RE: [Geeks that Gawk] Re: Help On awk



Or might try this one:



             awk -F":" '{if($1 == ZZ){print $6}}' ZZ=${username}
passwd.bak  >output





   _____

From: geeksthatgawk@yahoogroups.com
[mailto:geeksthatgawk@yahoogroups.com] On Behalf Of Adam
Sent: Monday, December 26, 2005 7:09 PM
To: geeksthatgawk@yahoogroups.com
Subject: [Geeks that Gawk] Re: Help On awk



I'm not sure, but
it looks like the apostrophies get in the way.
try:
awk -f":" '/'$username'/ { print $6 }' passwd.bak >output

I hope that works.

--- In geeksthatgawk@yahoogroups.com, renuka prasad
<renukaprasadtg@y...> wrote:
>
> Hi All,
>
>    I need a help from u.I'm getting the home directory
> from  passwd.bak file.I need to find the disk usage of
> that particular user.I'm getting output if i directly
> substitue variable $username with exact username.But
> i'm not getting output when i use in shell script.The
> contents is as follows:
>
> ---------------------------------------------------------------------
> # Script for displaying diskusage based on user name
> # Only username to be supplied by user
> echo "\n Please enter the username:\c"
> read username
> awk -F":" '/$username/ { print $6 }' passwd.bak >
> output
> echo " Home Directory Of $username "
> cat output
> echo " Disk Usage in KB:"
> sudo du -sk < output
> ----------------------------------------------------------------------
>  I really appreciate  any kind of help on this.Thanks
> in advance.
>
> Regards,
> Prasad
>
>
>
>
> __________________________________
> Yahoo! for Good - Make a difference this year.
> http://brand.yahoo.com/cybergivingweek2005/
>







SPONSORED LINKS

Basic programming language
<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic
+programming+language&w2=Computer+programming+languages&w3=Programming+l
anguages&w4=Java+programming+language&c=4&s=126&.sig=bnac3LCZpttb3c9FvbV
U-A>

Computer programming languages
<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=B
asic+programming+language&w2=Computer+programming+languages&w3=Programmi
ng+languages&w4=Java+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KV
ZQperFQ>

Programming languages
<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+prog
ramming+language&w2=Computer+programming+languages&w3=Programming+langua
ges&w4=Java+programming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ>


Java programming language
<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+
programming+language&w2=Computer+programming+languages&w3=Programming+la
nguages&w4=Java+programming+language&c=4&s=126&.sig=PZAexF9LyXpKb3HDJSlB
1g>







   _____

YAHOO! GROUPS LINKS



*      Visit your group "geeksthatgawk
<http://groups.yahoo.com/group/geeksthatgawk> " on the web.

*      To unsubscribe from this group, send an email to:
       geeksthatgawk-unsubscribe@yahoogroups.com
<mailto:geeksthatgawk-unsubscribe@yahoogroups.com?subject=Unsubscribe>

*      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .



   _____



[Non-text portions of this message have been removed]




   _____

YAHOO! GROUPS LINKS



*  Visit your group "geeksthatgawk
<http://groups.yahoo.com/group/geeksthatgawk> " on the web.

*  To unsubscribe from this group, send an email to:
	  geeksthatgawk-unsubscribe@yahoogroups.com
<mailto:geeksthatgawk-unsubscribe@yahoogroups.com?subject=Unsubscribe>

*  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .



   _____



[Non-text portions of this message have been removed]

#192 From: "Stout, Danny" <danny.stout@...>
Date: Tue Dec 27, 2005 1:55 pm
Subject: RE: [Geeks that Gawk] Re: Help On awk
dasthcc
Offline Offline
Send Email Send Email
 
Or might try this one:



             awk -F":" '{if($1 == ZZ){print $6}}' ZZ=${username}
passwd.bak  >output





   _____

From: geeksthatgawk@yahoogroups.com
[mailto:geeksthatgawk@yahoogroups.com] On Behalf Of Adam
Sent: Monday, December 26, 2005 7:09 PM
To: geeksthatgawk@yahoogroups.com
Subject: [Geeks that Gawk] Re: Help On awk



I'm not sure, but
it looks like the apostrophies get in the way.
try:
awk -f":" '/'$username'/ { print $6 }' passwd.bak >output

I hope that works.

--- In geeksthatgawk@yahoogroups.com, renuka prasad
<renukaprasadtg@y...> wrote:
>
> Hi All,
>
>    I need a help from u.I'm getting the home directory
> from  passwd.bak file.I need to find the disk usage of
> that particular user.I'm getting output if i directly
> substitue variable $username with exact username.But
> i'm not getting output when i use in shell script.The
> contents is as follows:
>
> ---------------------------------------------------------------------
> # Script for displaying diskusage based on user name
> # Only username to be supplied by user
> echo "\n Please enter the username:\c"
> read username
> awk -F":" '/$username/ { print $6 }' passwd.bak >
> output
> echo " Home Directory Of $username "
> cat output
> echo " Disk Usage in KB:"
> sudo du -sk < output
> ----------------------------------------------------------------------
>  I really appreciate  any kind of help on this.Thanks
> in advance.
>
> Regards,
> Prasad
>
>
>
>
> __________________________________
> Yahoo! for Good - Make a difference this year.
> http://brand.yahoo.com/cybergivingweek2005/
>







SPONSORED LINKS

Basic programming language
<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic
+programming+language&w2=Computer+programming+languages&w3=Programming+l
anguages&w4=Java+programming+language&c=4&s=126&.sig=bnac3LCZpttb3c9FvbV
U-A>

Computer programming languages
<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=B
asic+programming+language&w2=Computer+programming+languages&w3=Programmi
ng+languages&w4=Java+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KV
ZQperFQ>

Programming languages
<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+prog
ramming+language&w2=Computer+programming+languages&w3=Programming+langua
ges&w4=Java+programming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ>


Java programming language
<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+
programming+language&w2=Computer+programming+languages&w3=Programming+la
nguages&w4=Java+programming+language&c=4&s=126&.sig=PZAexF9LyXpKb3HDJSlB
1g>







   _____

YAHOO! GROUPS LINKS



*  Visit your group "geeksthatgawk
<http://groups.yahoo.com/group/geeksthatgawk> " on the web.

*  To unsubscribe from this group, send an email to:
	  geeksthatgawk-unsubscribe@yahoogroups.com
<mailto:geeksthatgawk-unsubscribe@yahoogroups.com?subject=Unsubscribe>

*  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .



   _____



[Non-text portions of this message have been removed]

#191 From: "Adam" <onzanews@...>
Date: Tue Dec 27, 2005 1:09 am
Subject: Re: Help On awk
adam_onza
Offline Offline
Send Email Send Email
 
I'm not sure, but
it looks like the apostrophies get in the way.
try:
awk -f":" '/'$username'/ { print $6 }' passwd.bak >output

I hope that works.

--- In geeksthatgawk@yahoogroups.com, renuka prasad
<renukaprasadtg@y...> wrote:
>
> Hi All,
>
>    I need a help from u.I'm getting the home directory
> from  passwd.bak file.I need to find the disk usage of
> that particular user.I'm getting output if i directly
> substitue variable $username with exact username.But
> i'm not getting output when i use in shell script.The
> contents is as follows:
>
> ---------------------------------------------------------------------
> # Script for displaying diskusage based on user name
> # Only username to be supplied by user
> echo "\n Please enter the username:\c"
> read username
> awk -F":" '/$username/ { print $6 }' passwd.bak >
> output
> echo " Home Directory Of $username "
> cat output
> echo " Disk Usage in KB:"
> sudo du -sk < output
> ----------------------------------------------------------------------
>  I really appreciate  any kind of help on this.Thanks
> in advance.
>
> Regards,
> Prasad
>
>
>
>
> __________________________________
> Yahoo! for Good - Make a difference this year.
> http://brand.yahoo.com/cybergivingweek2005/
>

#190 From: renuka prasad <renukaprasadtg@...>
Date: Mon Dec 26, 2005 10:07 am
Subject: Help On awk
renukaprasadtg
Offline Offline
Send Email Send Email
 
Hi All,

    I need a help from u.I'm getting the home directory
from  passwd.bak file.I need to find the disk usage of
that particular user.I'm getting output if i directly
substitue variable $username with exact username.But
i'm not getting output when i use in shell script.The
contents is as follows:

---------------------------------------------------------------------
# Script for displaying diskusage based on user name
# Only username to be supplied by user
echo "\n Please enter the username:\c"
read username
awk -F":" '/$username/ { print $6 }' passwd.bak >
output
echo " Home Directory Of $username "
cat output
echo " Disk Usage in KB:"
sudo du -sk < output
----------------------------------------------------------------------
  I really appreciate  any kind of help on this.Thanks
in advance.

Regards,
Prasad




__________________________________
Yahoo! for Good - Make a difference this year.
http://brand.yahoo.com/cybergivingweek2005/

Messages 190 - 220 of 221   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help