Sponsored Content
Full Discussion: wc -l across two servers
Top Forums UNIX for Dummies Questions & Answers wc -l across two servers Post 302071826 by Ecclesiastes on Tuesday 25th of April 2006 05:38:40 AM
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.
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
QUIZ(6) 							 BSD Games Manual							   QUIZ(6)

NAME
quiz -- random knowledge tests SYNOPSIS
quiz [-t] [-i file] [question answer] DESCRIPTION
The quiz utility tests your knowledge of random facts. It has a database of subjects from which you can choose. With no arguments, quiz displays the list of available subjects. The options are as follows: -t Use tutorial mode, in which questions are repeated later if you didn't get them right the first time, and new questions are presented less frequently to help you learn the older ones. -i Specify an alternative index file. Subjects are divided into categories. You can pick any two categories from the same subject. quiz will ask questions from the first cate- gory and it expects answers from the second category. For example, the command ``quiz victim killer'' asks questions which are the names of victims, and expects you to answer with the cause of their untimely demise, whereas the command ``quiz killer victim'' works the other way around. If you get the answer wrong, quiz lets you try again. To see the right answer, enter a blank line. Index and Data File Syntax The index and data files have a similar syntax. Lines in them consist of several categories separated by colons. The categories are regular expressions formed using the following meta-characters: pat|pat alternative patterns {pat} optional pattern [pat] delimiters, as in pat[pat|pat]pat In an index file, each line represents a subject. The first category in each subject is the pathname of the data file for the subject. The remaining categories are regular expressions for the titles of each category in the subject. In data files, each line represents a question/answer set. Each category is the information for the question/answer for that category. The backslash character (``'') is used to quote syntactically significant characters, or at the end of a line to signify that a continuation line follows. If either a question or its answer is empty, quiz will refrain from asking it. FILES
/usr/share/games/quiz.db The default index and data files. BUGS
quiz is pretty cynical about certain subjects. BSD
May 31, 1993 BSD
All times are GMT -4. The time now is 12:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy