Sponsored Content
Full Discussion: behaviour of awk
Top Forums UNIX for Dummies Questions & Answers behaviour of awk Post 302602158 by pandeesh on Sunday 26th of February 2012 12:54:46 PM
Old 02-26-2012
behaviour of awk

Can someone explain how the below awk simulates cat?
Code:
pandeeswaran@ubuntu:~$ awk '1' file
PSAPSR3 3722000 91989.25 2 98
PSAPSR7 1562000 77000.1875 5 95
PSAPUNDO 92000 4087.5625 4 96
pandeeswaran@ubuntu:~$ awk '2' file
PSAPSR3 3722000 91989.25 2 98
PSAPSR7 1562000 77000.1875 5 95
PSAPUNDO 92000 4087.5625 4 96
pandeeswaran@ubuntu:~$ awk '0' file
pandeeswaran@ubuntu:~$ awk '3' file
PSAPSR3 3722000 91989.25 2 98
PSAPSR7 1562000 77000.1875 5 95
PSAPUNDO 92000 4087.5625 4 96

So, any non zero value covered by '' will give the result similar to cat?
How it works?
Thanks
 

9 More Discussions You Might Find Interesting

1. Programming

Behaviour of default

Hi, If I have the following code : int i=2; switch(i) { case 1 : {};break; default : { printf("d"); };break; case 2 : { printf("2"); };break; } what will be the output? I had an understanding that case statements are taken sequentially so default will be executed. But... (5 Replies)
Discussion started by: soorajmu
5 Replies

2. Programming

Can some 1 explain why this behaviour

#include <iostream> using namespace std; int main() { const int l_test = 999999999; int *l_ptr = (int*) &l_test; cout<<"Constant Addr:"<<&l_test<<" Value:"<<l_test<<endl; cout<<"Pointer Addr:"<<l_ptr<<" Value:"<<*l_ptr<<endl; *l_ptr = 888888888; // Manipulating... (2 Replies)
Discussion started by: helpmenow
2 Replies

3. Shell Programming and Scripting

cp -R behaviour

i 've noticed the following difference between freebsd cp and gnu cp from the freebsd cp man page: -R ... If the source_file ends in a /, the contents of the directory are copied rather than the directory itself. ... on gnu cp from the man pagewhile on gnu cp manpage: ‘-r'... (2 Replies)
Discussion started by: aegis
2 Replies

4. Shell Programming and Scripting

Don't understand AWK asort behaviour

Hello, I have the following script : BEGIN { print "1 ***"; split("abc",T,""); T="e"; T="z"; T="y"; for (i in T) printf("%i:%s ",i,T); print ""; for (i=1; i<=length(T); i++) printf(T); print "" print "2 ***"; asort(T,U); for (i in U) printf("%i:%s ",i,U); ... (3 Replies)
Discussion started by: jgilot
3 Replies

5. Ubuntu

Weird rm behaviour

I am little bit confused by the behaviour of rm in Ubuntu. It seems that as a regular user I can delete files owned by another user even when the permissions are set to 644. Here is an example: cjohnson@carbon:~/test$ sudo touch testfile cjohnson@carbon:~/test$ ls -al total 8 drwxr-xr-x... (2 Replies)
Discussion started by: ccj4467
2 Replies

6. Programming

different behaviour in fg and bg

fg = foreground bg = background I have a cobol program that I start with a very simple script. The script is not at fault as it has not changed and the program worked in fg and bg before. I have altered the logging in the program and moved my cursor declare to working storage. The program runs... (6 Replies)
Discussion started by: Bruble
6 Replies

7. UNIX for Dummies Questions & Answers

Strange behaviour when output to terminal vs file (awk)

Hi all ! I noticed something very weird. I have a large pipe delimited file (20 fields/3,000 records) that looks like that: AAA|BBB|11111|22222|...|($NF of record 1) CCC|DDD|33333|44444|...|($NF of record 2) CCC|DDD|55555|66666|...|($NF of record 3) For the lines with same 1st and 2nd... (3 Replies)
Discussion started by: beca123456
3 Replies

8. Shell Programming and Scripting

Strange behaviour of arrays in awk

Imagine 2 files f1 f2: file1_l1_c1 code_to_find file1_l1_c3 file1_l2_c1 file1_code2 file1_l2_c3 file1_l3_c1 file1_code3 file1_l3_c3 file2_l1_c1 file2_l1_c2 code_to_find file2_l2_c1 file2_l2_c2 file2_code5 file2_l3_c1 file2_l3_c2 file2_code3 Say we want to print lines from f2 having... (5 Replies)
Discussion started by: ripat
5 Replies

9. Shell Programming and Scripting

awk Strange behaviour in AIX

Can someone please explain the strange behaviour.. I was just trying a few things to learn awk.. in the below code when I start the braces in the same line, the output is as expected, when I start at next line, output is displayed twice. Please see the file, code I tried and output below. ... (2 Replies)
Discussion started by: Kulasekar
2 Replies
seeded-in-ubuntu(1)					      General Commands Manual					       seeded-in-ubuntu(1)

NAME
seeded-in-ubuntu - Determine whether a package is safe to upload during a freeze SYNOPSIS
seeded-in-ubuntu [options] package... DESCRIPTION
Lists all the current daily images containing the specified packages. Or whether the package is part of the supported seed. If it isn't on an image, it should be safe to upload. During the final freeze, one should avoid packages in the supported seed too. An index of the current manifests is downloaded from UbuntuWire. OPTIONS
-b, --binary The packages specified are binary packages. This is faster than source packages, as otherwise we must query LP to determine the binary packages that every specified source package builds. -u URL, --data-url=URL URL for index of seeded packages. Default: UbuntuWire's service at http://qa.ubuntuwire.org/ubuntu-seeded-packages/seeded.json.gz. -h, --help Display a help message and exit EXAMPLES
All the images that contain unity: seeded-in-ubuntu -b unity AUTHORS
seeded-in-ubuntu and this manpage were written by Stefano Rivera <stefanor@ubuntu.com>. Both are released under the terms of the ISC License. ubuntu-dev-tools December 2011 seeded-in-ubuntu(1)
All times are GMT -4. The time now is 11:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy