wc -l across two servers


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers wc -l across two servers
# 1  
Old 04-25-2006
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.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mapping Servers

Hi All, I need an urgent assistance please . My case below: I have a list of 500 IP addresses. All These ip addresses are mapped/connected to different machine kinds : NT, Linux, Switch, Router ,FW, and so on. My Requirement is to filter from all this ip address only the Linux machines.... (2 Replies)
Discussion started by: James Stone
2 Replies

2. UNIX for Dummies Questions & Answers

Linked Servers

Hi, We have 2 UNIX Servers, say test1 and test2. Here, if I create a file or folder/delete a file or folder in the 1st server, it gets reflected automatically in the 2nd server. I don't think any links are established between these 2 servers. Both these have 2 different hostnames. How... (1 Reply)
Discussion started by: Dev_Dev
1 Replies

3. Solaris

sun servers currently used

can anybody give me a list of sun servers currently being used in the industry (5 Replies)
Discussion started by: veritas
5 Replies

4. Solaris

New to servers

Hey guys, I'm new to servers ( quite honestly, I'm not sure what i'm doing). Recently, I bought a Sunfire V100 to get me started. My goal is to learn how to set up a stable web hosting server where I can hold my clients' websites and also to learn a new field in Computer Science. I have a copy... (8 Replies)
Discussion started by: linuxleopard
8 Replies

5. Solaris

Servers and about them?

I want to learn about servers . I configured 3 virtual machines (Solaris , Linux and Windows) . I think this could be some kind of exchange of knowledge , and of course this could be a some kind of classroom for noobies :D! Ok now to the work ! My question is : what a server should... (9 Replies)
Discussion started by: solaris_user
9 Replies

6. Shell Programming and Scripting

Scp between two servers

Is there a way to connect betwwen two servers A and B without using prompting for a password ..... I am writing a script which includes picking up files from and puts them to B. using mget .. To make the script fully automable I am looking for a passwordless authentication... Any... (2 Replies)
Discussion started by: ultimatix
2 Replies

7. UNIX for Dummies Questions & Answers

connecting servers

Please help me out i want to know how to send email from unix machine to any email-id. mail to be sent is web based mail. (1 Reply)
Discussion started by: parmeet
1 Replies

8. UNIX for Dummies Questions & Answers

mail servers

What protocol would i use to transfer mail between two UNIX mail servers? (1 Reply)
Discussion started by: agoemann23
1 Replies

9. IP Networking

name servers

ok, I chose dhcp when I set up my first solaris box. I can ping ip addresses. If I do a nslookup on a domain name and enter the ip address in my browser I get a web page. I want to know how and where to specify what dns servers to look @. thanks (2 Replies)
Discussion started by: rpnhavoc
2 Replies
Login or Register to Ask a Question