Sponsored Content
Top Forums Shell Programming and Scripting Need script for Itanium server Post 302644003 by mohtashims on Monday 21st of May 2012 06:13:47 AM
Old 05-21-2012
CPU & Memory

Quote:
Originally Posted by bakunin
Code:
#!/bin/ksh
 
typeset chCmd="/path/to/Generateadd.sh -ip"
typeset pDir=/path/to/your/directory
typeset pFile=""
typeset chIP=""
 
ls $pDir | while read pFile ; do
     chIP="${pFile%.csv}"             # chop off the extension
     chIP="${chIP#card_}"             # chop off the leading "card_"
 
     $chCmd $chIP
done
 
exit 0

It is a bad idea to have relative paths in scripts, so i changed ./Generateadd.sh to a call with the absolute path. If you use relative paths in scripts that means the script will work in one directory but not in another.

I hope this helps.

bakunin
I dont think this script will work if the file name is "card_xyz_something_something_10.87.162.211.csv"

So, what I would like is the "_" just before the IP address to be considered for chopping off anything prior to that so I am just left with the IP address.

Can you please help tweak it and get it working for me ?
 

10 More Discussions You Might Find Interesting

1. HP-UX

How Many CPUs? (Itanium)

I've got a dual CPU Itanium server that we use for hosting our Oracle database. It's been up and running fine for quite some time. So well, in fact, that I haven't even looked at 'top' in a while. Recently I needed to look at 'top' and I only see one CPU listed now. CPU0. Is there any other... (5 Replies)
Discussion started by: deckard
5 Replies

2. HP-UX

Does HP-UX On Itanium always come with PA-RISC compatibility

Does anybody know if HP-UX on Itanium always comes with backwards compatibility for PA-RISC applications? I've heard that there is an emulator called Aries which should do the trick, I just need to know if it always comes as standard with HP-UX Itanium systems. Any help would be greatly... (3 Replies)
Discussion started by: nialler
3 Replies

3. UNIX for Advanced & Expert Users

What Are the Differences Between Itanium and x86_64 CPUs?

This is definitely a "stupid" question, but I can't think of anywhere else to ask it, so here goes. My knowledge of CPU history on big iron machines starts with the last DEC Alphas, a short stint with Sun servers, PA-RISC and Itanium, Intel 486s on the desktop before that, and Motorola 68000 CPUs... (4 Replies)
Discussion started by: deckard
4 Replies

4. HP-UX

Install tcsh on HP-UX 11.31 itanium

I have 2 servers , both are HP-UX specifications as follows : (1) HP-UX adroit B.10.20 A 9000/785 2013264127 one-user license (2) HP-UX xen B.11.31 U ia64 2662515494 one-user license First one has tcsh installed adroit:/home/seo/hitendra 22 ] which tcsh /usr/bin/tcsh But the... (1 Reply)
Discussion started by: hiten.r.chauhan
1 Replies

5. What is on Your Mind?

Oracle stops Itanium development

According to the press release, Oracle will stop supporting the Itanium platform altogether, including all databases. Just out of curiosity: what selling-points will there be left for Itanium servers? From personal experience I know that the ports of FLOS software are mostly very out of date... (4 Replies)
Discussion started by: pludi
4 Replies

6. UNIX for Advanced & Expert Users

Compiling git in HPUX 11.31 itanium

Hello, Would you know the steps on how to compile git command in HPUX? (1 Reply)
Discussion started by: SystemAddict
1 Replies

7. HP-UX

Gcc and C/aC++ co-existing on HP-UX Itanium system

Our company developed applications on an HP-UX 11 Itanium system using gcc. We did not have HP's C/aC++ system installed. We are now attempting to install/run on a customer system that already has C/aC++ on it. Can gcc (gcc-4.3.2, or just the runtime libraries gcclib-4.3.2) be installed and... (1 Reply)
Discussion started by: northb
1 Replies

8. HP-UX

Shc command for hp UNIX 11.23 itanium

(2 Replies)
Discussion started by: sagar_1986
2 Replies

9. HP-UX

PDFtk for HP-UX 11.31 Itanium 64

Hi Unix and HP-US experts, I have a need to encrypt/give password to PDF files in HP-UX servers, but unfortunately I am new to unix and hp-ux. My server is HP-UX 11.31 running on Itanium 64 bit architecture. I have downloaded and installed PDFtk from this link:... (1 Reply)
Discussion started by: villium
1 Replies

10. HP-UX

Installation of gnome 1.4 for HP itanium

Hi I can't download gnome from HP website because links are broken: I can only download patch for Gnome. Can you help me? --- Post updated at 05:18 PM --- I realized that I have to register on their website with the software depot to download it. (0 Replies)
Discussion started by: gbudny
0 Replies
typeset(1)							   User Commands							typeset(1)

NAME
typeset, whence - shell built-in functions to set/get attributes and values for shell variables and functions SYNOPSIS
typeset [ +- HLRZfilrtux [n]] [ name [ = value]]... whence [-pv] name... DESCRIPTION
typeset sets attributes and values for shell variables and functions. When typeset is invoked inside a function, a new instance of the variables name is created. The variables value and type are restored when the function completes. The following list of attributes may be specified: -H This flag provides UNIX to host-name file mapping on non-UNIX machines. -L Left justify and remove leading blanks from value. If n is non-zero it defines the width of the field; otherwise, it is determined by the width of the value of first assignment. When the variable is assigned to, it is filled on the right with blanks or trun- cated, if necessary, to fit into the field. Leading zeros are removed if the -Z flag is also set. The -R flag is turned off. -R Right justify and fill with leading blanks. If n is non-zero it defines the width of the field, otherwise it is determined by the width of the value of first assignment. The field is left filled with blanks or truncated from the end if the variable is reas- signed. The -L flag is turned off. -Z Right justify and fill with leading zeros if the first non-blank character is a digit and the -L flag has not been set. If n is non-zero it defines the width of the field; otherwise, it is determined by the width of the value of first assignment. -f The names refer to function names rather than variable names. No assignments can be made and the only other valid flags are -t, -u and -x. The flag -t turns on execution tracing for this function. The flag -u causes this function to be marked undefined. The FPATH variable will be searched to find the function definition when the function is referenced. The flag -x allows the func- tion definition to remain in effect across shell procedures invoked by name. -i Parameter is an integer. This makes arithmetic faster. If n is non-zero it defines the output arithmetic base; otherwise, the first assignment determines the output base. -l All upper-case characters are converted to lower-case. The upper-case flag, -u is turned off. -r The given names are marked readonly and these names cannot be changed by subsequent assignment. -t Tags the variables. Tags are user definable and have no special meaning to the shell. -u All lower-case characters are converted to upper-case characters. The lower-case flag, -l is turned off. -x The given names are marked for automatic export to the environment of subsequently-executed commands. The -i attribute can not be specified along with -R, -L, -Z, or -f. Using + rather than - causes these flags to be turned off. If no name arguments are given but flags are specified, a list of names (and optionally the values) of the variables which have these flags set is printed. (Using + rather than - keeps the values from being printed.) If no names and flags are given, the names and attributes of all variables are printed. For each name, whence indicates how it would be interpreted if used as a command name. The -v flag produces a more verbose report. The -p flag does a path search for name even if name is an alias, a function, or a reserved word. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
ksh(1), set(1), sh(1), attributes(5) SunOS 5.10 1 Feb 1995 typeset(1)
All times are GMT -4. The time now is 02:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy