write a perl script or kornshell reading a two files and outputting to comma format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting write a perl script or kornshell reading a two files and outputting to comma format
# 1  
Old 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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to write in multiple output files in perl?

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

2. Programming

Date format change from mm/dd/yyyy to yyyymmdd in comma seperate line in perl

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

3. Shell Programming and Scripting

Need script for transferring bulk files from one format to text format

"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

4. Shell Programming and Scripting

Perl Script for reading table format data from file.

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

5. Homework & Coursework Questions

Shell script calling Perl function, sort and find data, write to new files

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

6. Shell Programming and Scripting

Perl script to parse output and print it comma separated

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

7. Shell Programming and Scripting

Perl Script Not Reading Input Files Correctly

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

8. Shell Programming and Scripting

Reading comma separated variable into other variables in shell script

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

9. Shell Programming and Scripting

How to write shell script for input file name format checking?

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

10. Shell Programming and Scripting

how to write script in compress format

i have the script how to write script in compress format in tar (1 Reply)
Discussion started by: naveeng.81
1 Replies
Login or Register to Ask a Question
UFOND(1)						      General Commands Manual							  UFOND(1)

NAME
ufond - convert UNIX font files into Macintosh format SYNOPSIS
ufond [-dfont] [-macbin] [-res] [-script name] fontfile... DESCRIPTION
The program ufond takes UNIX font files, wraps them in a Macintosh resource fork, creates a family for them, and then wraps that in a macbinary or binhex file. The program reads one or more font files, specified at the end of the command line, using any of the following formats: Glyph Bitmap Distribution (.bdf) TrueType (.ttf) OpenType (.otf) POSTSCRIPT Binary format (.pfb) All fonts with the same font family name will be placed in the same FOND. The program associates the name of a POSTSCRIPT font with a bit- map font, as well as handling bold, italic, and other variants properly. The generated Macintosh files will be in one of three formats: MacBinary (default) dfont (data fork resource file format, used by MacOS X) bare resource fork (you have to know how to transform this into a real resource fork) The program normally assumes that your fonts are in the roman script system. If this is not true you may specify a script directly. The program knows the names of a few scripts (greek, cyrillic, hebrew, arabic) which may be entered directly; otherwise you must know the Mac- intosh script number. OPTIONS
-dfont Generate Macintosh files in dfont format. -macbin Generate Macintosh files in MacBinary format. -res Generate Macintosh files in resource format. -script name Specify the Macintosh script number. AUTHOR
George Williams (gww@silcom.com). Manual page by Ziying Sherwin (sherwin@nlm.nih.gov) and R.P.C Rodgers (rodgers@nlm.nih.gov), Lister Hill National Center for Biomedical Communications, U.S. National Library of Medicine. 23 October 2002 UFOND(1)