Sponsored Content
Top Forums Shell Programming and Scripting Stuck on a matching, copying type problem Post 302185327 by derek3131 on Monday 14th of April 2008 05:18:20 PM
Old 04-14-2008
Good gravy, why and i not getting how to do this seemingly simple problem? I really feel that I am making this harder then it needs to be..

Code:
#!/usr/bin/perl
#
$data = 'hou100cm,hou010008cs,purple
hou132cm,hou090026cs,purple
hou133cm,hou090057cs,purple
hou134cm,hou090064cs,blue
hou190cm,hou230095cs,blue
hou193cm,hou240058cs,purple
hou195cm,hou240124cs,purple
hou195cm,hou240125cs,purple
gpf132cm,gpf090013cs,purple
gpf132cm,gpf090028cs,purple
gpf133cm,gpf090036cs,purple
gpf133cm,gpf090051cs,blue
gpf133cm,gpf090059cs,purple
gpf134cm,gpf090067cs,purple
gpf134cm,gpf090079cs,blue
gpf136cm,gpf100002cs,blue
gpf136cm,gpf100003cs,purple
gpf136cm,gpf100024cs,blue
gpf141cm,gpf110059cs,blue
gpf139cm,gpf100099cs,blue
gpf139cm,gpf100100cs,purple
gpf139cm,gpf100101cs,purple';

$blue = 'gpf100024cs, MC1: row 1 channel 1
gpf100002cs, Bad DIMM slot (motherboard)
gpf090079cs, MC1: row 0 Channel 0
hou230095cs, Urgent message file problems reported
hou090064cs,  NODE USE DISABLED BY Jeff';

(master, node, status) = split(',', $data);
(node2,desc) = split(',', $blue);

I have tried to match $blue{$node2} =~ $data{$node} ;

then join($blue{$desc}) to $data for days now, i think i am confusing myself sense I think I have come up with at least 5 different ways that I thought would work on this... but no luck...

Can someone tell me what I am doing wrong here, my eyes have grown tired and my mind numb, please help if you can.

Basically two files $data and $Blue
Data has 0,1,2 fields and Blue has 0 and 1 field.
If $blue{field0} =~ $data{field1}, then copy or move $blue{field1} to $data{field3}. And of course field3 is newly created.

thank you for anyhelp . Smilie

Last edited by derek3131; 04-15-2008 at 09:12 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copying all files of type "pdf"

Hi, Within a shell script I'm trying to copy all the files in a directory structure to another folder but only the files of type "pdf" I have made a start but I can't work out how to finish it. find $ATEBUILD/doc/user -name "*.pdf" | xargs cp THEN WHAT? I hope this makes sense! Rob (6 Replies)
Discussion started by: milage
6 Replies

2. Shell Programming and Scripting

Problem with variable type

Dear All, I am trying to write an script to calculate geometric centre of selected residues of a protein structure. Say I have a PDB file (a text containing the x, y, and z coordinates of atoms of a protein). I want to extract the X coordinates of the atoms belonging to the interested residues... (2 Replies)
Discussion started by: siavoush
2 Replies

3. UNIX for Advanced & Expert Users

terminal type problem with cygwin on aix

hey, I use cygwin to connect to AIX 5.2 but when I open vi I get an error saying: ex: 0602-108 cygwin is not a recognized terminal type how can I fix that? I thought cygwin was tty vt100? (1 Reply)
Discussion started by: rein
1 Replies

4. UNIX for Advanced & Expert Users

Problem in copying files!!

I have requirement of one directory in /tmp area on Sun server. The area contains following files : brdcems# /tmp/.tivoli >>ls -lt total 0 srwxrwxrwx 1 root other 0 Nov 16 13:41 a9c30c14-80bf256e-94 srwxrwxrwx 1 root other 0 Nov 12 12:28 a9c30cc8-80bf256e-94 I... (4 Replies)
Discussion started by: ssk
4 Replies

5. SCO

Sco 6 copying problem

We are using GTAR for daily copies of our database using Travan cartridges (Tapestor drive)and are having intermittent problems. Some days it does not copy and we can't figure out why. Sometimes it seems to be hanging and a tape status command doesn't return anything. Other times it doesn't copy... (0 Replies)
Discussion started by: Yrr88
0 Replies

6. UNIX for Dummies Questions & Answers

Stuck with a simple find problem

Hi, Need some simple find help. I need to search for all .so files within sol directory. My directory tree has mix of directories and i want to search only inside sol directory. I could get this done combining find with for, any option to do this with find alone. for a in `find .... (13 Replies)
Discussion started by: vibhor_agarwali
13 Replies

7. Shell Programming and Scripting

Find problem listing directories even -type f

Hi All, #!/bin/ksh find /home/other -ls -type f -xdev | sort -nrk7 | head -2 >bigfile.txt The above is my script, which writes the large file into a file called bigfile.txt. My script contains only the above two lines. after execution i am getting the output like find: cannot chdir to... (1 Reply)
Discussion started by: Arunprasad
1 Replies

8. Shell Programming and Scripting

Problem with type-casting in awk

Hi I'm trying to write a script which takes an integer as input and checks for files with size > input and displays it on screen. The code I've tried : echo 'Enter the min file size expected' read filesize du -ah <folder name> | awk -F: '$1>int(filesize) {print $1,$2)' is always... (28 Replies)
Discussion started by: vivek.bharadwaj
28 Replies

9. Shell Programming and Scripting

korn shell display lenght problem!!! i got stuck on this

Using the KSH, write a shell script called display_by_length, which takes an absolute pathname to a directory and displays all ordinary files in the directory ordered by their length; for each file listed, display the name of the file and its length - nothing else. Extend this script to take an... (1 Reply)
Discussion started by: babuda0059
1 Replies

10. Shell Programming and Scripting

Type casting problem

hi guys, i m new to shell script.. i dont know how to type cast string into integers and i mention my problem below.. date="21091988" month=$((${date:2:2})) # extract the month from previous date variable temp=$(($month*23)) when i am trying to calculate the temp value i got the... (5 Replies)
Discussion started by: raadhaakrishnan
5 Replies
FILE2SDR(1)							  ICI executables						       FILE2SDR(1)

NAME
file2sdr - SDR data ingestion test program SYNOPSIS
file2sdr configFlags fileName DESCRIPTION
file2sdr stress-tests SDR data ingestion by repeatedly writing all text lines of the file named fileName to one of a series of non-volatile linked lists created in a test SDR data store named "testsdrconfigFlags". By incorporating the data store configuration into the name (e.g., "testsdr14") we make it relatively easy to perform comparative testing on SDR data stores that are identical aside from their configuration settings. The operation of file2sdr is cyclical: a new linked list is created each time the program finishes copying the file's text lines and starts over again. If you use ^C to terminate file2sdr and then restart it, the program resumes operation at the point where it left off. After writing each line to the current linked list, file2sdr gives a semaphore to indicate that the list is now non-empty. This is mainly for the benefit of the complementary test program sdr2file(1). At the end of each cycle file2sdr appends a final EOF line to the current linked list, containing the text "*** End of the file ***", and prints a brief performance report: Processing I<lineCount> lines per second. EXIT STATUS
0 file2sdr has terminated. FILES
No configuration files are needed. ENVIRONMENT
No environment variables apply. DIAGNOSTICS
Diagnostic messages produced by file2sdr are written to the ION log file ion.log. Can't use sdr. ION system error. Check for earlier diagnostic messages describing the cause of the error; correct problem and rerun. Can't create semaphore. ION system error. Check for earlier diagnostic messages describing the cause of the error; correct problem and rerun. SDR transaction failed. ION system error. Check for earlier diagnostic messages describing the cause of the error; correct problem and rerun. Can't open input file Operating system error. Check errtext, correct problem, and rerun. Can't reopen input file Operating system error. Check errtext, correct problem, and rerun. Can't read from input file Operating system error. Check errtext, correct problem, and rerun. BUGS
Report bugs to <ion-bugs@korgano.eecs.ohiou.edu> SEE ALSO
sdr2file(1), sdr(3) perl v5.14.2 2012-05-25 FILE2SDR(1)
All times are GMT -4. The time now is 03:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy