Need script for Itanium server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need script for Itanium server
# 1  
Old 05-18-2012
Question Need script for Itanium server

Hi,

I have a folder that has the below 6 files.
Code:
 
 
-rw-r-----   1 wlsuser    users        32203 May 16 09:41 card_10.77.200.100.csv
-rw-r-----   1 wlsuser    users       104119 May 16 09:42 card_135.57.206.116.csv
-rw-r-----   1 wlsuser    users        12412 May 16 09:42 card_10.141.29.144.csv
-rw-r-----   1 wlsuser    users        65171 May 16 09:42 card_10.87.162.211.csv
-rw-r-----   1 wlsuser    users        93162 May 16 09:43 card_10.112.68.10.csv
-rw-r-----   1 wlsuser    users        79674 May 16 09:43 card_10.87.225.156.csv

I want my script to run as below.

Code:
 
./Generateadd.sh -ip 10.77.200.100
.....
....
....
./Generateadd.sh -ip 10.87.225.156

for all the 6 IPs one after the other finishes.

Can someone please help me with the script.

Moderator's Comments:
Mod Comment edit by bakunin: The script you are looking for has nothing at all to do with architecture, so the "script for itanium server" is just a script - you could as well need a "script for a computer painted yellow". Things which would indeed be helpful to know like OS, shell to be used, etc. are in fact missing.

Further, this is by no means an "advanced" or "expert" question and you have posts enough under your belt to know that. Please post scripting questions in the scripting forum, you won't get any "better" answer here than there. I'm going to transfer the thread there.

Last edited by bakunin; 05-18-2012 at 08:48 AM..
# 2  
Old 05-18-2012
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

Last edited by bakunin; 05-18-2012 at 08:49 AM..
# 3  
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 ?
# 4  
Old 05-21-2012
Quote:
Originally Posted by mohtashims
I dont think this script will work if the file name is "card_xyz_something_something_10.87.162.211.csv"
You know what? Me neither. But it would have been a nice thing to define your problem correctly instead of letting me guess. I am a Sysadmin, being a psychic is not part of the job description.

Quote:
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 ?
Yes, i can. Replace:
Code:
     chIP="${chIP#card_}"             # chop off the leading "card_"

with this:

Code:
     chIP="${chIP##card_*_}"          # chop off the leading "card_" and everything up to the last "_"

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. HP-UX

Shc command for hp UNIX 11.23 itanium

(2 Replies)
Discussion started by: sagar_1986
2 Replies

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question