LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 09-03-2004, 08:43 PM   #1
Muzica
LQ Newbie
 
Registered: Jul 2003
Location: NYS USA
Distribution: Knoppix 7.2
Posts: 6

Rep: Reputation: 0
Korn shell script


Hi,

I am looking for scripts I can download, that will compare two files.
Both file are plan text, on a Solaris 9 server. Something in a korn shell scripts.
 
Old 09-04-2004, 08:52 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Tribblix, Ubuntu/WSL
Posts: 9,771

Rep: Reputation: 468Reputation: 468Reputation: 468Reputation: 468Reputation: 468
What about ? :
Code:
#!/bin/ksh
diff $1 $2
 
Old 09-04-2004, 04:26 PM   #3
Muzica
LQ Newbie
 
Registered: Jul 2003
Location: NYS USA
Distribution: Knoppix 7.2
Posts: 6

Original Poster
Rep: Reputation: 0
I tried this but its just not right.
I need to have file1 in a array and file2 in a loops. The output needs to be redirected to file3. I think?
 
Old 09-04-2004, 05:21 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Tribblix, Ubuntu/WSL
Posts: 9,771

Rep: Reputation: 468Reputation: 468Reputation: 468Reputation: 468Reputation: 468
Quote:
I tried this but its just not right.
Don't say it's not right, it complies with your four requests:
- it is downloadable
- it is under ksh
- it runs on Solaris 9 server
- it compares to plain text files

Well, let's try with your new clues (file1 is in an array, file2 is in the loop, file3 get the output):
Code:
#!/bin/ksh
set -A array file1 file1a file1b file1c
for i in ${array[@]}
do
  echo "==== $i vs file2 ===="
  diff $i file2
done > file3
 
Old 09-06-2004, 01:47 PM   #5
Muzica
LQ Newbie
 
Registered: Jul 2003
Location: NYS USA
Distribution: Knoppix 7.2
Posts: 6

Original Poster
Rep: Reputation: 0
Yes it works! I thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Arrays in Korn Shell...? vous Programming 1 03-26-2005 02:35 AM
Using a Korn shell in rc scripts desbyleo Solaris / OpenSolaris 3 11-12-2004 06:27 PM
unix korn shell script that interact with windows java program ann124 Programming 5 11-09-2004 10:14 PM
install korn shell namgor Linux - Newbie 1 07-12-2004 03:52 PM
a t&t korn shell 93 shook Linux - Software 4 02-01-2003 02:54 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 04:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration