The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Dns Servers vjm AIX 1 03-19-2008 03:45 AM
ksh to run servers pari111222 Shell Programming and Scripting 0 07-24-2007 09:46 AM
Web Servers spiderman UNIX for Advanced & Expert Users 1 11-12-2002 09:28 AM
DNS servers ignus7 UNIX for Dummies Questions & Answers 5 06-19-2002 01:52 PM
name servers rpnhavoc IP Networking 2 02-07-2002 06:24 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-25-2006
Registered User
 

Join Date: Apr 2006
Posts: 8
Question wc -l across two servers

Hello everyone, I am new to this forum so I dont really know how things work around here in terms of posting questions and getting answers. Anyway I have a question and I hop someone can help.

Here is the scenario. I have a script that counts the amount of lines in serial files as well as multi files using wc -l. The script works perfectly when used on the current server where it is stored but now I have been told that there is a folder with some files that need counting ona remote server. I initially I just wanted to tranfer the script over but because the remote server is the current production server and they dont want anyone messing with it, how can I modify my script to be used across to servers?

below is the script that counts the files on the same server where the count script is:

out=xxx_xxx_dq_counts_check.dat #dat file to store count results
bse=/usr/users/xxx/xxx #base dir
date > $bse/$out #overwrite existing file or create new file
filepath=$bse/$out #assign dir path and filename to variable '$filepath' for easy reference


export basedir1=$xx_xx_xx #where serial files are stored on the local server

if [ -d $basedir1 ] #check to see if dir exists
then
echo "...Starting to process serial files. Please wait...\n"
echo "\n...SERIAL FILES...\n" >> $filepath
for file in `ls -1 $basedir1`
do
cd $basedir1
echo $file #optional to display file currently being processed
wc -l $file >> $filepath #append to file here
done
echo "\n...Serial files processed, now processing multi-files. Please wait...\n"
else
echo Serial Folder $xx_xxx_SERIAL_MONTHLY not found.
echo Serial Folder $xx_xxx_SERIAL_MONTHLY not found. >>$filepath
fi

Now the files I need to look at are on a different server and I have been given a path like the one below:

//Server_Name/usr/users/User_Name/folder1/folder2/folder3/folder4/folder5

and the files whose lines I want to count are in folder 5 and to make matters complicated, I have both serial and Multi-files. I believe m_ls can be used to list the contents of the items in folder 5 on a different server but wc -l will not work. Can anyone help? is it possible to do what I propose to do or should I try something totally different?

thanks, any help will be greatly appreciated. Sorry if I didn't make myself very clear, just ask if you have any Q's

D.
Reply With Quote
Google UNIX.COM
Forum Sponsor
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:13 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0