Sponsored Content
Full Discussion: awk and execute command ???
Top Forums Shell Programming and Scripting awk and execute command ??? Post 302069687 by sabercats on Tuesday 28th of March 2006 12:31:06 PM
Old 03-28-2006
Hi vgersh99,
Because this myFile.txt have along list and I am sure it have cnt is = 5, then take that $1 is d1 at $2 is d2. So I update your code like this but it copy every thing to DATA2 directory and somehow it can not execute the testit.ksh. Any idea ?


#!/bin/ksh

while read d1 d2 cnt
do
(( cnt = 5 )) && testit.ksh "${d1}"
(( cnt = 5 )) && cp *.${d2}.* /DAT2/
done < myFile.txt
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How does this command execute?

Can somebody give me the explanation for this command line: ps>newfile<infile wc -l ? I am totally confused with the order of its execution.. :confused: Thanx, Saneesh Joseph. (3 Replies)
Discussion started by: saneeshjose
3 Replies

2. UNIX for Dummies Questions & Answers

Plz Help : How to use write command to execute command on some other terminal

Hi Group , I m trying to execute commands on some other system using write command but inspite of executing the commands they r passed as simple messages. - i m writing >write user-id ! ls o ctrl-d inspite of executing the command ls,other terminal shows ! ls. Thnx in advance. (2 Replies)
Discussion started by: Aashish
2 Replies

3. Shell Programming and Scripting

How to build a command into a string rather than execute the command

I'm trying to populate a command line into a variable. It appears to be executing, instead. Here's an example: mycmd='' if ...; then $mycmd='sudo ' fi $mycmd=$mycmd 'sed -i prev s/aaa/bbb/' $myfile res=`$mycmd` (I'm also not sure of the best way to execute the command from the... (1 Reply)
Discussion started by: littlejon
1 Replies

4. UNIX for Dummies Questions & Answers

how to execute an command this way

How to make it works this way? echo dir1\/*.txt ; echo dir1\/*.html | xargs wc -l dir1/*.txt wc: dir1/*.html: No such file or directory what i'm trying to do it to "wc dir1/*.txt" and "wc dir1/*.html" (2 Replies)
Discussion started by: Bornay6ah
2 Replies

5. Shell Programming and Scripting

awk and execute

Hi All, I need this to execute and not just print on Red Hat ent 4 bash shell. cat /etc/passwd|grep db2 | awk -F":" '{print "cat /etc/group | grep ",$4}' Output: cat /etc/group | grep 1000 (I don't want this to print but execute) Thanks for any comment you may add. (2 Replies)
Discussion started by: itik
2 Replies

6. Shell Programming and Scripting

Need help to execute command

HI, I have a directory called input directory called "input", The "input" directory contains file names (file1,file2,file3,file4), I want to write a command so that it will display all the file names with comma separated. Desired output: file1,file2,file3 so on.... Regards Akshay... (2 Replies)
Discussion started by: akshu.agni
2 Replies

7. Shell Programming and Scripting

Execute command from awk

This seemed straight forward until I tried to code it. I'm running ioscan -fuNC disk to get list of disk including hardware path. What I'm trying to do is use awk to take this output, extract hardware path, and pass that as a variable to ioscan -P wwid -N -H 64000/0xfa00/0x1a | grep ^disk and... (11 Replies)
Discussion started by: steve72
11 Replies

8. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

9. Shell Programming and Scripting

How to execute a command on each line of output from another command?

Hello :) new to bash not to programming. I have an on-going need to change the owning group on sets of files and directories from the one they were created with or changed to on update to the one they need to have going forward. find {target_root} -group wrong_group gets me a newline... (4 Replies)
Discussion started by: naftali
4 Replies

10. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies
Date::Manip::Obj(3pm)					User Contributed Perl Documentation				     Date::Manip::Obj(3pm)

NAME
Date::Manip::Obj - Base class for Date::Manip objects SYNOPSIS
The Date::Manip::Obj class is the base class used for the following Date::Manip classes: Date::Manip::Base Date::Manip::TZ Date::Manip::Date Date::Manip::Delta Date::Manip::Recur This module is not intended to be called directly and performs no useful function by itself. Instead, use the various derived classes which inherit from it. DESCRIPTION
This module contains a set of methods used by all Date::Manip classes listed above. You should be familiar with the Date::Manip::Objects and Date::Manip::Config documentation. In the method descriptions below, Date::Manip::Date objects will usually be used as examples, but (unless otherwise stated), all of the classes listed above have the same methods, and work in the same fashion. METHODS FOR CREATING OBJECTS
In the examples below, any $date ($date, $date1, $date2, ...) variable is a Date::Manip::Date object. Similarly, $delta, $recur, $tz, and $base refer to objects in the appropriate class. Any $obj variable refers to an object in any of the classes. new There are two ways to use the new method. They are: $obj2 = new CLASS ($obj1,$string,@opts); $obj2 = $obj1->new($string,@opts) In both cases, all arguments are optional. Here, CLASS is the class of the new object. For example: $date = new Date::Manip::Date; $delta = new Date::Manip::Delta; if $obj1 is available, the new object will share as much information from the old object as possible. The class of the new object may be derived from the old object as well. For example, if you call either of these: $date2 = new Date::Manip::Date $date1; $date2 = $date1->new(); the new date object will use the same embedded Date::Manip::TZ object. In the second case, the class of the new object ($date2) is Date::Manip::Date because that is the class of the original object. When specifying CLASS and including an old object, objects do not need to be of the same class. For example, the following are all valid: $date = new Date::Manip::Date $delta; $date = new Date::Manip::Date $tz; You can even do: $date = new Date::Manip::Date $base; but this will have to create a completely new Date::Manip::TZ object, which means that optimal performance may not be achieved if a Date::Manip::TZ object already exists. There are two special cases. Either of the following will create a new Date::Manip::Base object for handling multiple configurations: $base2 = new Date::Manip::Base $base1; $base2 = $base1->new(); Either of the following will create a new Date::Manip::TZ object with the same Date::Manip::Base object embedded in it: $tz2 = new Date::Manip::TZ $tz1; $tz2 = $tz1->new(); The new base object will initially have the same configuration as the original base object, but changing it's configuration will not affect the original base object. If the @opts argument is passed in, it is a list reference containing a list suitable for passing to the config method (described below). In this case, a new Date::Manip::Base object (and perhaps Date::Manip::TZ object) will be created. The new Base object will start as identical to the original one (if a previously defined object was used to create the new object) with the additional options in @opts added. In other words, the following are equivalent: $date = new Date::Manip::Date $obj,@opts; $base = $obj->base(); $base2 = $base->new(); $date = new Date::Manip::Date $base2; $date->config(@opts); It should be noted that the options are applied to the NEW object, not the old one. That only matters in one situation: $base2 = new Date::Manip::Base $base1,@opts; $base2 = $base1->new(@opts); An optional string ($string) may be passed in only when creating a Date::Manip::Date, Date::Manip::Delta, or Date::Manip::Recur object. If it is passed in when creating a Date::Manip::TZ or Date::Manip::Base object, a warning will be issued, but execution will continue. If the string is included, it will be parsed to give an initial value to the object. This will only be done AFTER any options are handled, so the following are equivalent: $date = new Date::Manip::Date $string,@opts; $date = new Date::Manip::Date; $date->config(@opts); $date->parse($string); Note that it is generally not a good idea to pass in $string since all of the parse methods allow (but do not require) additional arguments, and this ability is not supported when passing in $string to the new method. As a result, it's generally a better practice to call the parse method separately. Once a Date::Manip::Date object (or any object in any other Date::Manip class) is created, it should always be used to create additional objects in order to preserve cached data for optimal performance and memory usage. The one caveat is if you are working with multiple configurations as described in the Date::Manip::Objects document. In that case, you may need to create completely new objects to allow multiple Date::Manip::Base objects to be used. new_config $obj2 = $obj1->new_config($string,@opts); This creates a new instance with a new Date::Manip::Base object (and possibly a new Date::Manip::TZ object). For example, $date2 = $date1->new_config(); creates a new Date::Manip::Date object with a new Date::Manip::TZ (and Date::Manip::Base) object. Initially, it is the same configuration as the original object. If the object is a Date::Manip::Base object, the following are equivalent: $base2 = $base1->new_config(); $base2 = $base1->new(); Both $string and @opts are optional. They are used in the same way they are used in the new method. new_date new_delta new_recur These are shortcuts for specifying the class. The following sets of calls are all equivalent: $date = $obj->new_date(); $date = new Date::Manip::Date($obj); $delta = $obj->new_delta(); $delta = new Date::Manip::Date($obj); These methods all allow optional ($string,@opts) arguments. OTHER METHODS
base tz $base = $obj->base(); This returns the Date::Manip::Base object associated with the given object. If $obj is a Date::Manip::Base object, nothing is returned (i.e. it doesn't create a new copy of the object). $tz = $obj->tz(); This returns the Date::Manip::TZ object associated with the given object. If $obj is a Date::Manip::TZ or Date::Manip::Base object, nothing is returned. config $obj->config($var1,$val1,$var2,$val2,...); This will set the value of any configuration variables. Please refer to the Date::Manip::Config manual for a list of all configuration variables and their description. err $err = $obj->err(); This will return the full error message if the previous operation failed for any reason. $obj->err(1); will clear the error code. is_date is_delta is_recur $flag = $obj->is_date(); Returns 0 or 1, depending on the object. For example, a Date::Manip::Date object returns 1 with the is_date method, and 0 for the other two. version $vers = $obj->version($flag); This returns the version of Date::Manip. If $flag is passed in, and $obj is not a Date::Manip::Base object, the version and timezone information will be passed back. KNOWN BUGS
None known. BUGS AND QUESTIONS
Please refer to the Date::Manip::Problems documentation for information on submitting bug reports or questions to the author. SEE ALSO
Date::Manip - main module documentation LICENSE
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHOR
Sullivan Beck (sbeck@cpan.org) perl v5.14.2 2012-06-02 Date::Manip::Obj(3pm)
All times are GMT -4. The time now is 08:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy