Sponsored Content
Top Forums Shell Programming and Scripting looping through a variable in a shell script Post 302109194 by ramachandranrr on Sunday 4th of March 2007 06:34:18 PM
Old 03-04-2007
looping through a variable in a shell script

hi,

my first question is :-

i would like to know how do i loop through the output of a variable.

for ex:- if i have a variable called x and echo $x gives the output like

feb 19 07

feb 20 07

feb 21 07

i would like to know how do i loop through this since it is separated and i woul be using this output elsewhere also.

My second question is :-

how do i merge two outputs which can be looped.

example :-

i have the output in one file as

xyz|123|27|feb|2003

wer|342|23|feb|2005

sde|143|30|feb|2006

the output of the second file is

99991231 feb 15
20061121 feb 23
20060915 feb 25


now i would like the final output to be

xyz|123|27|feb|2003|99991231 feb 15

wer|342|23|feb|2005|20061121 feb 23


sde|143|30|feb|2006|20060915 feb 25


thanks a lot in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Looping a perl script in a shell script

I am trying to get the follow script to run in the background on the 'fly'. I can launch it via cron and it will run in the background. BUT when I launch it from the command line it will run in the foreground. I figure it has to do with the while loop I have, but I have no clue how I can run the... (8 Replies)
Discussion started by: edkung
8 Replies

2. Shell Programming and Scripting

Convert shell script for looping

Situation: I have a working shell script on our file server (OSXS Tiger) to connect to a workstation, which is using a portable home directory (phd), and rsync a user's MirrorAgent.log. I'm not that strong of a scripter (obviously), but I would like to add other workstations to this script as they... (4 Replies)
Discussion started by: le0pard13
4 Replies

3. Shell Programming and Scripting

Looping through a shell script with sql statements

Hello members, I'm working on the Solaris environment and the DB i'm using is Oracle 10g. Skeleton of what I'm attempting; Write a ksh script to perform the following. I have no idea how to include my sql query within a shell script and loop through the statements. Have therefore given a... (4 Replies)
Discussion started by: novice82
4 Replies

4. Shell Programming and Scripting

assign awk's variable to shell script's variable?

Dear All, we have a command output which looks like : Total 200 queues in 30000 Kbytes and we're going to get "200" and "30000" for further process. currently, i'm using : numA=echo $OUTPUT | awk '{print $2}' numB=echo $OUTPUT | awk '{print $5}' my question is : can I use just one... (4 Replies)
Discussion started by: tiger2000
4 Replies

5. Shell Programming and Scripting

C Shell Script: While function not fully looping

I am new to scripting and this is probably the 4th or 5th simple script I have written. I am working with a HUGE number of data that need to be organized into folders and named a certain way. I wrote the naming script using a while function to go through the 1000-some folders and rename the files... (0 Replies)
Discussion started by: notluckyhannah
0 Replies

6. Shell Programming and Scripting

Looping in the shell script with help of script timer.

Hello Experts- We are facing some issues in the while loop script when we use the script time to decide whether to exist from the loop or continue. Below is the script SrcExitLoop="FALSE" Src_InitialStartTime=`date +%s` Src_StartTime=`date +%s` Src_NUM_ALERTS=0 TOTAL_ALERTS=`expr <SOME... (4 Replies)
Discussion started by: Amey Joshi
4 Replies

7. Shell Programming and Scripting

Looping not completing in shell script

Hi, Iam using below code to login to servers to get cpu utilisation. but output is coming for only one server. code is below root@blr-svr-oclan-01 # more SSSC_CPU_UTIL1.sh #!/bin/sh echo "CPU UTILIZATION" while read line; do IDLE=`/usr/local/bin/sshpass -p 'xxx' ssh xxx@$line 'sar 2 2' |... (1 Reply)
Discussion started by: surender reddy
1 Replies

8. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies

9. UNIX for Beginners Questions & Answers

How can I assign awk's variable to shell script's variable?

I have the following script, and I want to assign the output ($10 and $5) from awk to N and L: grdinfo data.grd | awk '{print $10,$5}'| read N L output from gridinfo data.grd is: data.grd 50 100 41 82 -2796 6944 0.016 0.016 3001 2461. where N and L is suppose to be 3001 and 100. I use... (8 Replies)
Discussion started by: geomarine
8 Replies

10. Shell Programming and Scripting

Looping on variable having new line \n fails

I have a for loop that constructs a variable "filelistonly" having entries separated by "\n" new line. The second, third & fourth while loops are my attempt to iterate the variable "filelistonly" upon new line "\n", however non of them work. Below is my script: //First Loop for i in... (2 Replies)
Discussion started by: mohtashims
2 Replies
DateTime::Locale::nl_BE(3)				User Contributed Perl Documentation				DateTime::Locale::nl_BE(3)

NAME
DateTime::Locale::nl_BE SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'nl_BE' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Dutch Belgium. DATA
This locale inherits from the DateTime::Locale::nl locale. It contains the following data. Days Wide (format) maandag dinsdag woensdag donderdag vrijdag zaterdag zondag Abbreviated (format) ma di wo do vr za zo Narrow (format) M D W D V Z Z Wide (stand-alone) maandag dinsdag woensdag donderdag vrijdag zaterdag zondag Abbreviated (stand-alone) ma di wo do vr za zo Narrow (stand-alone) M D W D V Z Z Months Wide (format) januari februari maart april mei juni juli augustus september oktober november december Abbreviated (format) jan. feb. mrt. apr. mei jun. jul. aug. sep. okt. nov. dec. Narrow (format) J F M A M J J A S O N D Wide (stand-alone) januari februari maart april mei juni juli augustus september oktober november december Abbreviated (stand-alone) jan. feb. mrt. apr. mei jun. jul. aug. sep. okt. nov. dec. Narrow (stand-alone) J F M A M J J A S O N D Quarters Wide (format) 1e kwartaal 2e kwartaal 3e kwartaal 4e kwartaal Abbreviated (format) K1 K2 K3 K4 Narrow (format) 1 2 3 4 Wide (stand-alone) 1e kwartaal 2e kwartaal 3e kwartaal 4e kwartaal Abbreviated (stand-alone) K1 K2 K3 K4 Narrow (stand-alone) 1 2 3 4 Eras Wide Voor Christus Anno Domini Abbreviated v. Chr. n. Chr. Narrow v. Chr. n. Chr. Date Formats Full 2008-02-05T18:30:30 = dinsdag 5 februari 2008 1995-12-22T09:05:02 = vrijdag 22 december 1995 -0010-09-15T04:44:23 = zaterdag 15 september -10 Long 2008-02-05T18:30:30 = 5 februari 2008 1995-12-22T09:05:02 = 22 december 1995 -0010-09-15T04:44:23 = 15 september -10 Medium 2008-02-05T18:30:30 = 5-feb.-2008 1995-12-22T09:05:02 = 22-dec.-1995 -0010-09-15T04:44:23 = 15-sep.--10 Short 2008-02-05T18:30:30 = 5/02/08 1995-12-22T09:05:02 = 22/12/95 -0010-09-15T04:44:23 = 15/09/-10 Default 2008-02-05T18:30:30 = 5-feb.-2008 1995-12-22T09:05:02 = 22-dec.-1995 -0010-09-15T04:44:23 = 15-sep.--10 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Long 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Datetime Formats Full 2008-02-05T18:30:30 = dinsdag 5 februari 2008 18:30:30 UTC 1995-12-22T09:05:02 = vrijdag 22 december 1995 09:05:02 UTC -0010-09-15T04:44:23 = zaterdag 15 september -10 04:44:23 UTC Long 2008-02-05T18:30:30 = 5 februari 2008 18:30:30 UTC 1995-12-22T09:05:02 = 22 december 1995 09:05:02 UTC -0010-09-15T04:44:23 = 15 september -10 04:44:23 UTC Medium 2008-02-05T18:30:30 = 5-feb.-2008 18:30:30 1995-12-22T09:05:02 = 22-dec.-1995 09:05:02 -0010-09-15T04:44:23 = 15-sep.--10 04:44:23 Short 2008-02-05T18:30:30 = 5/02/08 18:30 1995-12-22T09:05:02 = 22/12/95 09:05 -0010-09-15T04:44:23 = 15/09/-10 04:44 Default 2008-02-05T18:30:30 = 5-feb.-2008 18:30:30 1995-12-22T09:05:02 = 22-dec.-1995 09:05:02 -0010-09-15T04:44:23 = 15-sep.--10 04:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 di 1995-12-22T09:05:02 = 22 vr -0010-09-15T04:44:23 = 15 za Hm (HH:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 PM 1995-12-22T09:05:02 = 9:05 AM -0010-09-15T04:44:23 = 4:44 AM Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 PM 1995-12-22T09:05:02 = 9:05:02 AM -0010-09-15T04:44:23 = 4:44:23 AM M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (d-M) 2008-02-05T18:30:30 = 5-2 1995-12-22T09:05:02 = 22-12 -0010-09-15T04:44:23 = 15-9 MEd (E d-M) 2008-02-05T18:30:30 = di 5-2 1995-12-22T09:05:02 = vr 22-12 -0010-09-15T04:44:23 = za 15-9 MMd (d-MM) 2008-02-05T18:30:30 = 5-02 1995-12-22T09:05:02 = 22-12 -0010-09-15T04:44:23 = 15-09 MMdd (dd-MM) 2008-02-05T18:30:30 = 05-02 1995-12-22T09:05:02 = 22-12 -0010-09-15T04:44:23 = 15-09 MMM (LLL) 2008-02-05T18:30:30 = feb. 1995-12-22T09:05:02 = dec. -0010-09-15T04:44:23 = sep. MMMd (d-MMM) 2008-02-05T18:30:30 = 5-feb. 1995-12-22T09:05:02 = 22-dec. -0010-09-15T04:44:23 = 15-sep. MMMEd (E d MMM) 2008-02-05T18:30:30 = di 5 feb. 1995-12-22T09:05:02 = vr 22 dec. -0010-09-15T04:44:23 = za 15 sep. MMMMd (d MMMM) 2008-02-05T18:30:30 = 5 februari 1995-12-22T09:05:02 = 22 december -0010-09-15T04:44:23 = 15 september MMMMEd (E d MMMM) 2008-02-05T18:30:30 = di 5 februari 1995-12-22T09:05:02 = vr 22 december -0010-09-15T04:44:23 = za 15 september mmss (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (M-yyyy) 2008-02-05T18:30:30 = 2-2008 1995-12-22T09:05:02 = 12-1995 -0010-09-15T04:44:23 = 9--010 yMEd (EEE d-M-yyyy) 2008-02-05T18:30:30 = di 5-2-2008 1995-12-22T09:05:02 = vr 22-12-1995 -0010-09-15T04:44:23 = za 15-9--010 yMMM (MMM y) 2008-02-05T18:30:30 = feb. 2008 1995-12-22T09:05:02 = dec. 1995 -0010-09-15T04:44:23 = sep. -10 yMMMEd (EEE d MMM y) 2008-02-05T18:30:30 = di 5 feb. 2008 1995-12-22T09:05:02 = vr 22 dec. 1995 -0010-09-15T04:44:23 = za 15 sep. -10 yMMMM (MMMM y) 2008-02-05T18:30:30 = februari 2008 1995-12-22T09:05:02 = december 1995 -0010-09-15T04:44:23 = september -10 yQ (Q yyyy) 2008-02-05T18:30:30 = 1 2008 1995-12-22T09:05:02 = 4 1995 -0010-09-15T04:44:23 = 3 -010 yQQQ (QQQ y) 2008-02-05T18:30:30 = K1 2008 1995-12-22T09:05:02 = K4 1995 -0010-09-15T04:44:23 = K3 -10 yyMM (MM-yy) 2008-02-05T18:30:30 = 02-08 1995-12-22T09:05:02 = 12-95 -0010-09-15T04:44:23 = 09--10 yyMMM (MMM yy) 2008-02-05T18:30:30 = feb. 08 1995-12-22T09:05:02 = dec. 95 -0010-09-15T04:44:23 = sep. -10 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyQQQQ (QQQQ yy) 2008-02-05T18:30:30 = 1e kwartaal 08 1995-12-22T09:05:02 = 4e kwartaal 95 -0010-09-15T04:44:23 = 3e kwartaal -10 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = februari 2008 1995-12-22T09:05:02 = december 1995 -0010-09-15T04:44:23 = september -10 Miscellaneous Prefers 24 hour time? Yes Local first day of the week maandag SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::nl_BE(3)
All times are GMT -4. The time now is 01:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy