Sponsored Content
Full Discussion: For loop and awk print
Top Forums Shell Programming and Scripting For loop and awk print Post 302777553 by MadeInGermany on Friday 8th of March 2013 05:09:53 AM
Old 03-08-2013
Oh dear...and ' $cnt ' does not substitute the shell variable.
Better a simple for loop
Code:
tmpVar="abc bbc cbc nbc mbc"
for t1 in $tmpVar
do
 echo "$t1"
done

 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I get awk to print a " in it's print part?

The line is simple, use " '{ print $1"]"$2"\"$3THE " NEEDS TO GO HERE$4 }' I've tried \", "\, ^" and '"" but none of it works. What am I missing? Putting in the [ between $1 and $2 works fine, I just need to do the same with a ". Thanks. (2 Replies)
Discussion started by: LordJezo
2 Replies

2. Shell Programming and Scripting

loop + sum + print using awk

Hi, I am unable sum of each column in the loop usng awk command. Awk is not allowing the parameters in the command. i am facing the below error. awk: 0602-562 Field $() is not correct. Source file abc.txt 100,200,300,400,500,600,700,800,900 101,201,301,401,501,601,701,801,901 ... (1 Reply)
Discussion started by: number10
1 Replies

3. Shell Programming and Scripting

awk to loop lines and print substring

The input data: mbeanName: com.sap.default:name=tc~bl~deploy_controller,j2eeType=SAP_J2EEServicePerNode,SAP_J2EEClusterNode=3620850,SAP_J2EECluster=XXX Get attribute Properties: {undepl_parallelism_strategy=normal, deployment_forbidden=off, locking_retries=50, suppress_ds_warnings=on,... (5 Replies)
Discussion started by: ux4me
5 Replies

4. Shell Programming and Scripting

For loop inside awk to read and print contents of files

Hello, I have a set of files Xfile0001 - Xfile0021, and the content of this files (one at a time) needs to be printed between some line (lines start with word "Generated") that I am extracting from another file called file7.txt and all the output goes into output.txt. First I tried creating a for... (5 Replies)
Discussion started by: jaldo0805
5 Replies

5. UNIX for Dummies Questions & Answers

Print each output of loop in new column using awk or shell

I have this output from a loop a11 1,2 3,4 5,6 7,8 12,8 5,4 3,6 a12 10,11 12,13 15,18 20,22 a13 ... (3 Replies)
Discussion started by: maryre89
3 Replies

6. Shell Programming and Scripting

awk loop using array:wish to store array values from loop for use outside loop

Here's my code: awk -F '' 'NR==FNR { if (/time/ && $5>10) A=$2" "$3":"$4":"($5-01) else if (/time/ && $5<01) A=$2" "$3":"$4-01":"(59-$5) else if (/time/ && $5<=10) A=$2" "$3":"$4":0"($5-01) else if (/close/) { B=0 n1=n2; ... (2 Replies)
Discussion started by: klane
2 Replies

7. Shell Programming and Scripting

Print awk output in same line ,For loop

My code is something like below. #/bin/bash for i in `ps -ef | grep pmon | grep -v bash | grep -v grep | grep -v perl | grep -v asm | grep -v MGMT|awk '{print $1" "$8}'` do echo $i ORACLE_SID=`echo $line | awk '{print $2}'` USERNAME=`echo $line | awk '{print $1}'` done ============= But... (3 Replies)
Discussion started by: tapia
3 Replies

8. Shell Programming and Scripting

Use while loop to read file and use ${file} for both filename input into awk and as string to print

I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix. I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice. Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies
IO::Async::Timer::Absolute(3pm) 			User Contributed Perl Documentation			   IO::Async::Timer::Absolute(3pm)

NAME
"IO::Async::Timer::Absolute" - event callback at a fixed future time SYNOPSIS
use IO::Async::Timer::Absolute; use POSIX qw( mktime ); use IO::Async::Loop; my $loop = IO::Async::Loop->new; my @time = gmtime; my $timer = IO::Async::Timer::Absolute->new( time => mktime( 0, 0, 0, $time[4]+1, $time[5], $time[6] ), on_expire => sub { print "It's midnight "; $loop->stop; }, ); $loop->add( $timer ); $loop->run; DESCRIPTION
This subclass of IO::Async::Timer implements one-shot events at a fixed time in the future. The object waits for a given timestamp, and invokes its callback at that point in the future. For a "Timer" object that waits for a delay relative to the time it is started, see instead IO::Async::Timer::Countdown. EVENTS
The following events are invoked, either using subclass methods or CODE references in parameters: on_expire Invoked when the timer expires. PARAMETERS
The following named parameters may be passed to "new" or "configure": on_expire => CODE CODE reference for the "on_expire" event. time => NUM The epoch time at which the timer will expire. Once constructed, the timer object will need to be added to the "Loop" before it will work. Unlike other timers, it does not make sense to "start" this object, because its expiry time is absolute, and not relative to the time it is started. AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.14.2 2012-10-24 IO::Async::Timer::Absolute(3pm)
All times are GMT -4. The time now is 01:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy