Sponsored Content
Full Discussion: awk basics
Top Forums Shell Programming and Scripting awk basics Post 302078684 by vish_indian on Tuesday 4th of July 2006 03:13:57 AM
Old 07-04-2006
Quote:
Originally Posted by gfhgfnhhn
what is wrong with the code below;
it starts ,then does nothing, (even it doesn't end)

#!/bin/awk
x=1
b="foo"
awk printf("%s got a %d on the last test\n","Jim",83)
myout=("%s-%d",b,x)
print myout
awk is awaiting input from a file or command line. If you want to run it without having to enter the input, try:

BEGIN{
a=1;
b="foo";
printf("%s got a %d on the last test\n","Jim",83)
myout="%s %d \n";
printf myout,b,a;
}
_______________________________________________________________________
else try:
{
a=1;
b="foo";
printf("%s got a %d on the last test\n","Jim",83)
myout="%s %d \n";
printf myout,b,a;
}'
"hello"
To end it type ^D. Pressing enter continues printing the output.
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix Basics

Hey, you said this forum was for Dummies, so don't blame me for the following! :D My whole "web building" life, I've had my sites hosted in one for or another. Lately, I've gotten into PHP and MySQL and, of course, those are also hosted for me. But lately, I've been thinking of using PHP and... (2 Replies)
Discussion started by: cap97
2 Replies

2. Shell Programming and Scripting

Scripts and basics

Hi, I have a script which I need to modify the date "01/10/2008" and "31/10/2008" every month before running the report. Can I have some script to take the date automatically from the cal option. Hope it makes sense. Thanks in advance. (1 Reply)
Discussion started by: Jayanthsec
1 Replies

3. UNIX for Dummies Questions & Answers

awk basics and ebook request

Dear All, Could someone suggest a resource where I can start learning awk from scratch. I'm a biologist with little command line experience but I need some data analysis to be done. I've realised from reading forums and talking to bioinformaticians that awk is extremely powerful to perform... (1 Reply)
Discussion started by: pawannoel
1 Replies

4. UNIX for Dummies Questions & Answers

awk basics

Hi, Please tell me where can I get started with awk..like the basics and the whole awk stuff. Regards, Deepti (2 Replies)
Discussion started by: gaur.deepti
2 Replies

5. AIX

AIX Basics

Hello , Everyone , I want to know the Aix Basics and how it works ,hardware related problems and solution etc. (1 Reply)
Discussion started by: narendram
1 Replies

6. UNIX for Dummies Questions & Answers

help me with basics

hello everyone i have to start with unix as it is a part of my training programme and i have to do a self study, i dont know where to start from. i need some basic questions to be answerd like why we use unix ? what is a terminal? what is an editor? why we write commands inside terminal? these... (4 Replies)
Discussion started by: aryancool
4 Replies

7. UNIX for Dummies Questions & Answers

UNIX Basics

Hello, 1) I am trying to get involved in UNIX for educational purposes so I have installed the latest Ubuntu edition 12.04. Do you know another package that I could use it instead for educational purposes? 2)What is the difference between "~$" and "/$" (it comes with cd / and cd ~) .The... (1 Reply)
Discussion started by: Iwn
1 Replies
PRINT(3)								 1								  PRINT(3)

print - Output a string

SYNOPSIS
int print (string $arg) DESCRIPTION
Outputs $arg. print is not actually a real function (it is a language construct) so you are not required to use parentheses with its argument list. PARAMETERS
o $arg - The input data. RETURN VALUES
Returns 1, always. EXAMPLES
Example #1 print examples <?php print("Hello World"); print "print() also works without parentheses."; print "This spans multiple lines. The newlines will be output as well"; print "This spans multiple lines. The newlines will be output as well."; print "escaping characters is done "Like this"."; // You can use variables inside a print statement $foo = "foobar"; $bar = "barbaz"; print "foo is $foo"; // foo is foobar // You can also use arrays $bar = array("value" => "foo"); print "this is {$bar['value']} !"; // this is foo ! // Using single quotes will print the variable name, not the value print 'foo is $foo'; // foo is $foo // If you are not using any other characters, you can just print variables print $foo; // foobar print <<<END This uses the "here document" syntax to output multiple lines with $variable interpolation. Note that the here document terminator must appear on a line with just a semicolon no extra whitespace! END; ?> NOTES
Note Because this is a language construct and not a function, it cannot be called using variable functions. SEE ALSO
echo(3), printf(3), flush(3), Heredoc syntax. PHP Documentation Group PRINT(3)
All times are GMT -4. The time now is 02:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy