09-13-2009
write a perl script or kornshell reading a two files and outputting to comma format
Hello
Can someone help me to write a perl script or kornshell reading a two files and outputting to comma format.
Here is the two files
listofdisks.txt
id, diskname, diskgroup, diskisze(GB), FC
1, CN34, GRP1, 30, FC_CN34
2, CN67, GRP5, 19,
4, VD1, GRP4, 23, FC_VD1
6, CF_D1, GRP10, 23,
10, CN1, GRP4, 20, FC_CN1
11, vcD1, GRP1, 5,
second file
listofhostmappedtodisks.txt
hostname, diskname
CN12A, CN34
CN3C, VD1
CN12B, CN34
CL2, CN67
CN3A, VD1
CN3B, VD1
DF1, CF_D1
F1, CN1
The out should look like this:
OUTPUT
id, diskname hostname diskgroup diskisze(GB) FC
1, CN34, CN12A/CN12B GRP1, 30, FC_CN34
2, CN67, CL2, GRP5, 19,
4, VD1, CN3C/CN3A/CN3B, GRP4, 23, FC_VD1
6, CF_D1, DF1, GRP10, 23,
10, CN1, F1, GRP4, 20, FC_CN1
11, vcD1, GRP1, 5,
Thanks for your help in advance
Deiow
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i have the script how to write script in compress format in tar (1 Reply)
Discussion started by: naveeng.81
1 Replies
2. Shell Programming and Scripting
Hello,
I had written a shell script that accepts input file as cmd line argument and process this file.
if ; then
if ; then
. $1
LOGFILE="$LOG_FILE/MIG_BIOS.log";
get_input_file
else
ERROR_CODE=MSCRM0005_003
error "$ERROR_CODE : Input file $1 is not available";
exit... (3 Replies)
Discussion started by: Poonamol
3 Replies
3. Shell Programming and Scripting
Hi,
In shell script, I have a variable var = xyz, inn, day, night, calif ....n and I would like to read them in to var1 = xzy, var2 = inn, var3= day, var4 = night....var.
probably in a loop. I would like to read the variables until end of the line. Comma is the delimiter and there's no comma at... (3 Replies)
Discussion started by: suryaemlinux
3 Replies
4. Shell Programming and Scripting
This is one of the strangest things that's happening to me.
I'm writing a new Perl script that is trying to read a file.
The file is originally in .mof format, but I also saved the contents into a .txt file.
As a simple test, I wrote this:
#!/user/bin/perl -w
use strict;
... (3 Replies)
Discussion started by: kooshi
3 Replies
5. Shell Programming and Scripting
I need to arrange output of SQL query into a comma separated format and I'm struggling with processing the output...
The output is something like this:
<Attribute1 name><x amount of white spaces><Atribute value>
<Attribute2 name><x amount of white spaces><Atribute value>
<Attribute3... (2 Replies)
Discussion started by: Juha
2 Replies
6. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
I must write a shell script that calls two external Perl functions--one of which sorts the data in a file, and... (6 Replies)
Discussion started by: kowit010
6 Replies
7. Shell Programming and Scripting
Hi,
i need a perl script which reads the file, content is given below. and output in new file.
TARGET DRIVE IO1 IO2 IO3 IO4 IO5
------------ --------- --------- --------- --------- ---------
0a.1.8 266 236 ... (3 Replies)
Discussion started by: asak
3 Replies
8. Shell Programming and Scripting
"Help Me" Need script for transferring bulk files from one format to text format in a unix server.
Please suggest (2 Replies)
Discussion started by: Kranthi Kumar
2 Replies
9. Programming
Hi All,
I have line
,A,FDRM0002,12/21/2017,,0.961751583,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
it contains date in mm/dd/yyyy format i want to change this to yyyymmdd format using perl.
Use code tags, thanks. (8 Replies)
Discussion started by: vishal0746
8 Replies
10. UNIX for Beginners Questions & Answers
hi,
Hope you are doing good.
During my coding yesterday i got this challenge, actually not a challenge it like to optimize the code.
I am printing some statement to monitor the file progress in the log file an also to display it in the screen. so i ended up in the below statements.
... (6 Replies)
Discussion started by: mad man
6 Replies
LEARN ABOUT DEBIAN
amfetchdump
AMFETCHDUMP(8) System Administration Commands AMFETCHDUMP(8)
NAME
amfetchdump - extract backup images from multiple Amanda tapes.
SYNOPSIS
amfetchdump [-c|-C|-L] [-p|-n] [-a] [-O directory] [-d device] [-h] [--header-file filename] [--header-fd fd] [-o configoption...] config
hostname [disk [ date [ level [ hostname [...] ] ] ]]
DESCRIPTION
Amfetchdump pulls one or more matching dumps from tape or from the holding disk, handling the reassembly of multi-tape split dump files as
well as any tape autochanger operations.
It will automatically use the Amanda catalog to locate available dumps on tape, in the same way that the find feature of amadmin(8) lists
available dumps.
The hostname, diskname, datestamp, and level dump specifications are further described in amanda-match(7). Note that at minimum a hostname
must be specified.
Unless -p is used, backup images are extracted to files in the current directory named:
If a changer error occurs, or the -d option is given, then amfetchdump prompts for each required volume.
hostname.diskname.datestamp.dumplevel
OPTIONS
-p
Pipe exactly one complete dump file to stdout, instead of writing the file to disk. This will restore only the first matching dumpfile
(where "first" is determined by the dump log search facility).
-h
Output the amanda header as a 32K block to same output as the image.
--header-fd fd
Output the amanda header to the numbered file descriptor.
--header-file filename
Output the amanda header to the filename.
-d device_or_changer
Restore from this device or changer instead of the default, prompting for each volume.
-O directory
Output restored files to this directory, instead of to the current working directory.
-c
Compress output, fastest method available.
-C
Compress output, smallest file size method available.
-l
Leave dumps in the compressed/uncompressed state in which they were found on tape. By default, amfetchdump will automatically
uncompress when restoring.
-a
Assume that all tapes are already available, via tape changer or otherwise, instead of prompting the operator to ensure that all tapes
are loaded.
-n
Do not reassemble split dump files at all, just restore each piece as an individual file.
-o configoption
See the "CONFIGURATION OVERRIDE" section in amanda(8).
EXAMPLES
All the examples here assume your configuration is called SetA.
Here's a simple case, restoring all known dumps of the host vanya to the current working directory.
$ amfetchdump SetA vanya
A more likely scenario involves restoring a particular dump from a particular date. We'll pipe this one to GNU-tar as well, to
automatically extract the dump.
$ amfetchdump -p SetA vanya /home 20051020 | gtar -xvpf -
CAVEATS
Amfetchdump is dependent on accessing your server's config, tape changer, and (normally) dump logs. As such, it's not necessarily the most
useful tool when those have all been wiped out and you desperately need to pull things from your tape. Pains have been taken to make it as
capable as possible, but for seriously minimialist restores, look to amrestore(8) or dd(8) instead.
SEE ALSO
amanda(8), amanda-match(7), amadmin(8), amrestore(8)
The Amanda Wiki: : http://wiki.zmanda.com/
AUTHORS
John Stange <building@nap.edu>
National Academies Press
Ian Turner <ian@zmanda.com>
Zmanda, Inc. (http://www.zmanda.com)
Amanda 3.3.1 02/21/2012 AMFETCHDUMP(8)