The Open Source Swiss Army Knife

/code/awk/
/code/awk/ + sub-categories
http://www.sirfsup.com/
web directory content
    
      

Not logged in
Chat Register Login
return to:  http:/www.sirfsup.com      /code   /awk 
sub-categories and articles

                                                  
dirdelete_some_lines add
dirhtml_awk add
   --->create new sub-category


addr2line.awk
add

#!/bin/awk -f # Copyright (C) 2000 Free Software Foundation # This file is part of libgcj. # This software is copyrighted work licensed under the terms of the # Libgcj License. Please consult the file "LIBGCJ_LICENSE" for

awk.awk
add

awk {print } translog.20020726125829.log | more mod ----------------- ===== ===== ===== C ===== ===== B ===== ===== C C ===== ===== ===== ===== C ===== ===== B B ===== ===== C C ===== ===== B B ===== ===== C C ===== ===== B B ===== ===== D D ===== ===== ===== ===== B ===== ===== C ===== ===== ===== ===== C ===== ===== B ===== ===== C ===== ===== B ===== ===== D ===== ===== ===== ===== B ===== ===== ===== ===== ===== ===== C ===== ===== B ===== ===== C ===== ===== ===== ===== C ===== awk {print } translog.20020726125829.log | sort | more ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ----------------- B B B B B B B B B B B B C C C C C C C C C C C C C C D D D mod

awk.htm
more guidelines

  1. awk

comparison.awk
add

cat $ORATAB | while read LINE do case $LINE in \#*) ;; #comment-line in oratab *)

dead.letter.txt
add

From joe Fri Sep 6 14:32:23 2002 Return-Path: Received: (from joe@localhost) by www.sirfsup.com (8.11.0/8.9.3) id g86JWNL02722 for Your; Fri, 6 Sep 2002 14:32:23 -0500

dos_2_unix.awk
add

awk 'sub("$", "\r")' unixfile.txt > dosfile.txt

function.awk
add

# capitalize each word in a string function capitalize (input, result, words, n, i, w) { result = ""

genbki.sh
from postgresql/src/backend/catalog

#! /bin/sh #------------------------------------------------------------------------- # # genbki.sh-- # shell script which generates .bki files from specially formatted .h

local_src.txt
add

pwd /usr/share/awk

ls_file.awk
add

#!/bin/awk -f BEGIN { i=0; #unnecessary while ( "ls -la " | getline ) { if ( $5 < 100) { name[i] = $NF; size[i] = $5;

passwds
add

here is all your text, joser

print.awk
add

#!/bin/awk -f BEGIN { object = ARGV[1]; ARGV[1] = ""; }

print2.awk
add

ls -lah | awk '{print $9 "\t\t" $5}' | sort

rnarozny
chmod 700 mail_send; mail_send some_file

#!/bin/awk -f { cmd = "cat passwds | mail -s 'Your password for xyz' daz@jrfii.com"; system(cmd); }

search_print
add

if (/match/) {print;}

search_print.awk
add

#!/bin/awk -f # ifconfig | awk -f search_print.awk BEGIN {} { if (/inet addr/) {print;}

short.awk
ps -ef | awk '$4 > 60'

ps -ef | awk '$4 > 60'

touch_access.awk
add

#!/bin/awk -f # run as ls -la | awk -f touch_access.awk BEGIN { i = 0 } { if ($1 ~ /^d.*/ amp;amp; $9 !~ /[\.|\.\.]/ ) {

translog.20020726125829.log
add

mod id time_now date_entered date_posted account num description memo action reconciled amount price date_reconciled ----------------- ===== START ===== END ===== START

unix_2_dos.awk
awk '{ sub(" $", ""); print }' dosfile.txt > unixfile.txt

awk '{ sub("\r$", ""); print }' dosfile.txt > unixfile.txt

unzip.awk
add

#!/bin/awk -f BEGIN { i = 0 } { if ($1 ~ /.*\.zip/) { cmd = "mkdir -p ch"i "; cd ch"i "; unzip ../" $1 " ; cd .. ";

validity.awk
add

awk '{$2 = 3 print }' /etc/password

x288.htmlFTN.AEN350
add

<html><head></head><body> <h2>awk</H2 >/tmp</EM > directory. `ls -lk' gives you all directories and files in the current directory and the size is printed in kilobytes. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="PROGRAMLISTING" >$ ls -lk /tmp <TT CLASS="COMPUTEROUTPUT" >-rw-r--r-- 1 patrice patrice 474 Mar 14 09:24 baz -rw-r--r-- 1 tester tester 44 Mar 14 09:24 foo drwxr-xr-x 2 patrice patrice 4096 Mar 14 09:24 foobar -rw------- 1 patrice patrice 1261 Mar 14 09:24 quotes</TT ></PRE ></FONT ></TD ></TR ></TABLE ><P > If you want to calculate the size of all files owned by &#8220;patrice&#8221;, you can use <B CLASS="COMMAND" >awk</B >. The following script does that for you: </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="PROGRAMLISTING" >$ ls -lk /tmp | awk '/^-/ &#38;&#38; $3=="patrice" { total +=$5 } END { print total "k" }'</PRE ></FONT ></TD ></TR ></TABLE ><P > How does it work? Every column of the ls command is stored in a variable. The variable is a dollar sign followed by the number of the column. The first line of the awk script matches all lines starting with a dash (this are files) and where the third column is equal to &#8220;patrice&#8221;. As the third column contains the owner name this gets all files owned by patrice. The block inside the curly braces gets executed for each match. This code sums up the size of this file to a total. </P > </body></html>
x288.htmlFTN.AEN350.txt add

awk

/tmp directory. `ls -lk' gives you all directories and files in the current directory and the size is printed in kilobytes.

$ ls -lk /tmp -rw-r--r-- 1 patrice patrice     474 Mar 14 09:24 baz -rw-r--r-- 1  tester  tester      44 Mar 14 09:24 foo drwxr-xr-x 2 patrice patrice    4096 Mar 14 09:24 foobar -rw------- 1 patrice patrice    1261 Mar 14 09:24 quotes

If you want to calculate the size of all files owned by “patrice”, you can use awk. The following script does that for you:

$ ls -lk /tmp | awk '/^-/ && $3=="patrice" { total +=$5 } END { print total "k" }'

How does it work? Every column of the ls command is stored in a variable. The variable is a dollar sign followed by the number of the column. The first line of the awk script matches all lines starting with a dash (this are files) and where the third column is equal to “patrice”. As the third column contains the owner name this gets all files owned by patrice. The block inside the curly braces gets executed for each match. This code sums up the size of this file to a total.

   --->upload your article


User submitted category site links

(None)
-->submit a page from your site dealing with awk to the sirfsup! web directory for listing
return to top