Here is my problem.. i have 2 files (file1, file2).. i have wrote the last two lines and first 4 lines of "file2" into two different variables .. say..
my $firstrec = `head -4 $file2`;
my $lastrec = `tail -2 $file2`;
and i write the rest of the file2 to a tmpfile and cat it with head -4 | tail -2 of file1 ...
now i need to add the first line and last lines to this tmpfile...
any suggestions are appreciated......thanks
I'm confused, why are you using perl if you are shelling out to the operating system? Unless file2 is gigantic, read it all into an array. Then use the array to do what you want.
Of course all those temp arrays are probably not necessary, I just use them to illustrate the array slice syntax you can use to achieve this using perl.
But I do not understand this requirement so I can't advise further:
Hi All,
I need to write a shell script(ksh) to take the tables backup in oracle(exporting tables data).
The tables list is not static, and those are selecting through dynamic sql
query. Can any body help how to write this shell script.
Thanks, (3 Replies)
Hi all!
I have to write a perl script that gets trashholds from a file and match them with an output of a command.
The trashhold file looks like this:
"pl-it_prod.GW.Sync.reply.*" "500" "-1" "" ""
"pl-it_prod.A.*" "100" "-1" "" ""
"application.log" ... (29 Replies)
Hi,
I have two text files. Need to create a third text file extracting specific data from first two existing files..
Text File 1: Format contains:
SQL*Loader: Release 10.2.0.1.0 - Production on Wed Aug 4 21:06:34 2010
some text ............so on...and somwhere text like:
Record 1:... (1 Reply)
I have written a perl scripts which loads the data.
Now i want to modify the script, to Archive the Input file after the successful load of data.
Can anyone please share it and help me ....
Thanks. (2 Replies)
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)
I have a function which does awk proceessing
sub mergeDescription {
system (q@awk -F'~' '
NR == FNR {
A = $1
B = $2
C = $0
next
}
{
n = split ( C, V, "~" )
if... (3 Replies)
Hi,
I am new to perl.
I am trying to write a small perl script for search and replace in a file :
========================================================
#!/usr/bin/perl
my $searchStr = "register_inst\.write_t\(";
my $replaceStr = "model\.fc_block\.";
open(FILE,"temp.sv") ||... (2 Replies)
Hi, I am complete new to C programming and shell scripting. I just wrote a simple C code to calculate integral using trapezoid rule. I am prompting user to pass me No. of equally spaced points , N , upper and lower limit. My code looks as follows so far:
#include<stdio.h>
#include<string.h>... (2 Replies)
Hi There,
I'm trying to write a simple script that will email me when we have an application job in a certain status that needs human intervention. I've used this script for other tables and it works great. However, this one gives me the warning that there is binary data so it might not. ... (2 Replies)
We have the data looks like below in a log file.
I want to generat files based on the string between two hash(#) symbol like below
Source:
#ext1#test1.tale2 drop
#ext1#test11.tale21 drop
#ext1#test123.tale21 drop
#ext2#test1.tale21 drop
#ext2#test12.tale21 drop
#ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies
LEARN ABOUT MINIX
diff
DIFF(1) General Commands Manual DIFF(1)NAME
diff - print differences between two files
SYNOPSIS
diff [-c | -e | -C n] [-br]file1 file2
OPTIONS -C n Produce output that contains n lines of context
-b Ignore white space when comparing
-c Produce output that contains three lines of context
-e Produce an ed-script to convert file1 into file2
-r Apply diff recursively to files and directories of
EXAMPLES
diff file1 file2 # Print differences between 2 files
diff -C 0 file1 file2
# Same as above
diff -C 3 file1 file2
# Output three lines of context with every
diff -c file1 file2 # Same
diff /etc /dev # Compares recursively the directories /etc and /dev
diff passwd /etc # Compares ./passwd to /etc/passwd
DESCRIPTION
the same name, when file1 and file2 are both directories" difference encountered"
Diff compares two files and generates a list of lines telling how the two files differ. Lines may not be longer than 128 characters. If
the two arguments on the command line are both directories, diff recursively steps through all subdirectories comparing files of the same
name. If a file name is found only in one directory, a diagnostic message is written to stdout. A file that is of either block special,
character special or FIFO special type, cannot be compared to any other file. On the other hand, if there is one directory and one file
given on the command line, diff tries to compare the file with the same name as file in the directory directory.
SEE ALSO cdiff(1), cmp(1), comm(1), patch(1).
DIFF(1)