UNIX Command Line: Count number of occurrences using awk
http://www.unixcl.com/2008/05/count-number-of-occurrences-using-awk.html
I want to calculate the number of occurrences of each letter in each column.A C TA A TB T AA C BB C CC C BT A TC A A February 29, 2012 at 8:46 PM sagar Utturkar said... Wait, there is just a little problem, I want also that it put out a 0 when it can t find anything, is that possible? October 19, 2012 at 6:32 PM Jadu Saikia said..
http://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
Instead of just accepting the PATH that is set from all the different initialization files that get installed, I prefer using getconf to identify the system path and place it first, then add my preferred path order, then use awk to remove any duplicates. Note that we don't need look for quoted : characters because shells don't provide quoting to support directories with : in its name in the PATH variable
awk - Get exact position of string in a file- UNIX command line - Stack Overflow
http://stackoverflow.com/questions/19076128/get-exact-position-of-string-in-a-file-unix-command-line
Theres some interesting differences between our approaches, the most notable being that you advance the string past the first character of the matched word while I advance it beyond the whole of the matched word
http://unix.stackexchange.com/questions/48777/command-to-display-first-few-and-last-few-lines-of-a-file
So, you could use a tool that reads one character at a time like the shell's read (here using a function that takes the number of head lines and tail lines as arguments). This does have the downside of not working if the input is a pipe, however you can use proccess substitution, in case your shell supports it (look at example below)
UNIX Command Line: Sed - save changes to same file
http://www.unixcl.com/2010/01/sed-save-changes-to-same-file.html
Wednesday, January 27, 2010 Sed - save changes to same file Sed receives text input, either from stdin or from a file, performs certain operations on specified lines(or all lines) of the input, one line at a time, then outputs the result to stdout or to a file
http://www.linuxfocus.org/English/September1999/article103.html
The matching condition could be very flexible, variing from a simple regular expression to a check on the contents of some field, with the possibility of grouping conditions with the proper logical operators. and a solution Deeper AWK Working over matched lines Awk as a programming language Including libraries Conclussions Additional information Examples with awk: A short introduction Abstract: This article gives some insight in to the tricks that you can do with AWK
Top Examples of Awk Command in Unix
http://www.folkstalk.com/2011/12/good-examples-of-awk-command-in-unix.html
The input "file.txt" contains the data in the following format 1 U,N,UNIX,000 2 N,P,SHELL,111 3 I,M,UNIX,222 4 X,Y,BASH,333 5 P,R,SCRIPT,444 Required output: Now we have to print only the lines in which whose 2nd field has the string "UNIX" as the 3rd field( The 2nd filed in the line is separated by comma delimiter )
http://www.unix.com/unix-for-advanced-and-expert-users/170239-unix-script-read-execute-command-stored-text-file-ksh-environment.html
The thing is that this File will be provided by Development team and being an Admin we need to read this file and execute all the command lines such as commands to run an Oracle sql file, pmcmd command to run Informatica flow, to FTP some files etc.. We already have a script to run all the SQLs in one shot but here the requirement is bit different as input file some time can have commands to run SQLs, pmcmd commands, FTP script and so on.
awk - How to remove blank lines from a unix file - Stack Overflow
http://stackoverflow.com/questions/14570489/how-to-remove-blank-lines-from-a-unix-file
It might be that you don't have blank lines but you have lots of spaces at the end of a line so it looks like you have blank lines when you cat the file to the screen
http://www.grymoire.com/Unix/Awk.html
There is one minor problem with associative arrays, especially if you use the for command to output each element: you have no control over the order of output. However, if you deleted the first print statement, it would print out "Three" once! I thought this was very strange at first, but after pulling out some hair, kicking the deck, and yelling at muself and everyone who had anything to do with the development of UNIX, it is intuitively obvious
Linux and UNIX awk command help and examples
http://www.computerhope.com/unix/uawk.htm
according to the printf format fmt system(cmd) executes cmd and returns its exit status tolower(str) returns a copy of str with all upper-case characters translated to their corresponding lower-case equivalents. A pattern may consist of two patterns separated by a comma; in this case, the action is performed for all lines from an occurrence of the first pattern though an occurrence of the second
The UNIX School: awk - Read a file and split the contents
http://www.theunixschool.com/2011/05/awk-read-file-and-split-contents.html
As said above, no action part denotes just to print which is the default when no action statement is given, and hence the entire file contents get printed
http://linux.about.com/library/cmd/blcmdl1_awk.htm
Since functions were not originally part of the AWK language, the provision for local variables is rather clumsy: They are declared as extra parameters in the parameter list. This is called a positional specifier and is intended primarily for use in translated versions of format strings, not in the original text of an AWK program
The UNIX School: awk - 10 examples to read files with multiple delimiters
http://www.theunixschool.com/2012/07/awk-10-examples-to-read-files-with.html
Difference between using square brackets and not using it : When a set of delimiters are specified using square brackets, it means an OR condition of the delimiters
No comments:
Post a Comment