08-22-2008
perl script file manipulation
Please let me know.. How to manipulate the data from two files..?
I have two files, file1 has two columns one is variable and second is description. file2 has five columns first column is variable and last one is description..Appreciate the help
I need to overwrite the description from file1 to file2 as per the variables..
e.g. file1
var1 <correct description>
var2 <correct description>
abc1 <correct description>
bcd3 <correct description>
.....
file2
var1 cl1 cl2 cl3 <wrong description1>
var1 b1 b3 b4 <wrong description3>
abc1 1 2 3 4 <wrong description1>
abc2 1 2 3 4 <wrong description7>
unknon m n po e <wrong description7>
unknon sf dvd dvd <wrong description7>
bcd3 p q r t <wrong description7
bcd3 n mb c <wrong description1>
......
result would be in file2
var1 cl1 cl2 cl3
var1 b1 b3 b4 <correct description>
abc1 1 2 3 4
abc2 1 2 3 4 <correct description>
unknon m n po e
unknon sf dvd dvd <wrong description7>
bcd3 p q r t <wrong description7
bcd3 n mb c <wrong description1>
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello guys..
I have the following question.
lets have that i have the following variable:
$field=werfiurd383nd93bc93 c93 d93 d9e3 ddd
or
array=werfiurd383nd93bc93 c93 d93 d9e3 ddd
what i would like to do is to store the first 4 characters of gthe aboce variable in variable... (1 Reply)
Discussion started by: chriss_58
1 Replies
2. Shell Programming and Scripting
Hi all,
Supposing the following string:
XXXXXXXXXXNEAXXXXXX
How can I check if this string has the substring NEA?
Best regards
Chris (3 Replies)
Discussion started by: chriss_58
3 Replies
3. Shell Programming and Scripting
Hi,
Please advise me how to perform checking in perl on the following input below.
The output criteria will be
1. field 1 will begin as 913354744 for each as example
2. field 4 must be unique.
3. field 7 is showing dd/mm/yyyy, but it require checking if unixtime should covert to... (5 Replies)
Discussion started by: rauphelhunter
5 Replies
4. Shell Programming and Scripting
hi all,
i am trying to append the output of a find command (for different paths)in an array as below...
my $res_array;
$i=0;
$dir="/orn/ops/regs";
foreach $block("am","xb"){
$bdir="$dir/$block";
$res_array=`find $bdir ! -user mainuser -printf \"\%u \%h\\n\"`;
$i++;
}
i... (6 Replies)
Discussion started by: saapa
6 Replies
5. Shell Programming and Scripting
Hello All,
I have been working on a great script to remotely gather server info and store it in a .txt that can be imported to .xls
I have been reading the hostnames that are in the /.shh/known_hosts file so I don't have to mess with passing a password - via ssh (not easy to do , by the... (1 Reply)
Discussion started by: dfezz1
1 Replies
6. Shell Programming and Scripting
I'm in need of help for a project that I'm working on. I believe Perl would be the best way of handling the string manipulation, however, I've barely used perl, and I'm used to BASH scripting. Another note is, this project is in a Windows environment, so I can use Perl, but I do not have shell... (1 Reply)
Discussion started by: drewrockshard
1 Replies
7. Shell Programming and Scripting
Hello,
I have mysql binary file which logs all the database queries and i to insert all queries log in to database. First i coverted binary file to text file. and start playing with it. Text file contains following queries, some samples are,
SET INSERT_ID=1;
INSERT INTO test... (0 Replies)
Discussion started by: mirfan
0 Replies
8. Shell Programming and Scripting
I don't know if this is a big issue or not, but I'm having difficulties. I apoligize for the upcoming essay :o.
I'm writing a script, similar to a paint program that edits images, but in the form of ANSI block characters. The program so far is working. I managed to save the image into a file,... (14 Replies)
Discussion started by: tinman47
14 Replies
9. UNIX for Dummies Questions & Answers
I am a UNIX newbee . I have been doing some reading lately but really need help with an an urgent requirement.After almost two days of googling I end up with 0 luck. Hopefully a guru on here will be able to help me out. Here is my requirement:
I have 20 files in a directory with detail records... (6 Replies)
Discussion started by: jeyd
6 Replies
10. Shell Programming and Scripting
Hi,
I have a file about 100 lines. Each line is about 2000 characters (each line is fixed length). In middle of each line is following constant value
0000040029892586
Now, I want to go through each line and increment by 1.
So, line 1 will have 586
line 2 will have 587, line 3 will have... (4 Replies)
Discussion started by: jakSun8
4 Replies
XZDIFF(1) XZ Utils XZDIFF(1)
NAME
xzcmp, xzdiff, lzcmp, lzdiff - compare compressed files
SYNOPSIS
xzcmp [cmp_options] file1 [file2]
xzdiff [diff_options] file1 [file2]
lzcmp [cmp_options] file1 [file2]
lzdiff [diff_options] file1 [file2]
DESCRIPTION
xzcmp and xdiff invoke cmp(1) or diff(1) on files compressed with xz(1), lzma(1), gzip(1), or bzip2(1). All options specified are passed
directly to cmp or diff. If only one file is specified, then the files compared are file1 (which must have a suffix of a supported com-
pression format) and file1 from which the compression format suffix has been stripped. If two files are specified, then they are uncom-
pressed if necessary and fed to cmp(1) or diff(1). The exit status from cmp or diff is preserved.
The names lzcmp and lzdiff are provided for backward compatibility with LZMA Utils.
SEE ALSO
cmp(1), diff(1), xz(1), gzip(1), bzip2(1), zdiff(1)
BUGS
Messages from the cmp(1) or diff(1) programs refer to temporary filenames instead of those specified.
Tukaani 2009-07-05 XZDIFF(1)