Sponsored Content
Top Forums Shell Programming and Scripting Help On Unix Script Count Line Of File Post 302166117 by fafo77 on Monday 11th of February 2008 02:49:02 AM
Old 02-11-2008
Tk you but still error...

Thenk's a lot for the response, but it still give me a:

...../Send..sh: syntax error at line 167: `n=$' unexpected

it looks like it doesn't like:
n=$(ls -| | wc -l $file)

any other suggestions, also because after I need to do some arithmethic operations with n, like:
n=$n-9


tk's again
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Want display a line with space in file by unix script

HI , I am having a file as -----------------a.out------------------- Hi I am unix developer using hp unix this is a test --------------------------------------- i need to read each line by a unix script of the file and to print in console with the space in the line as ... (9 Replies)
Discussion started by: arunkumar_mca
9 Replies

2. Shell Programming and Scripting

Get the line count from 2nd line of the file ?

Hi, I want to get the line count of the file from the 2nd line of the file ? The first line is header so want to skip that. Thanks. (8 Replies)
Discussion started by: smc3
8 Replies

3. Shell Programming and Scripting

File Line Count

Hi, Came across a weird problem today. I was just trying to write this small script which would read the number of lines in a file. Depending on the count some further processing would be done. I used wc -l in order to get that done. But since it depends on the number of new line characters, if... (1 Reply)
Discussion started by: King Nothing
1 Replies

4. Shell Programming and Scripting

Shell script to count number of ~ from each line and compare with next line

Hi, I have created one shell script in which it will count number of "~" tilda charactors from each line of the file.But the problem is that i need to count each line count individually, that means. if line one contains 14 "~"s and line two contains 15 "~"s then it should give an error msg.each... (3 Replies)
Discussion started by: Ganesh Khandare
3 Replies

5. Shell Programming and Scripting

Want to write a script for mailing line count

Hi all, I have a directory in which files are formed daily at certain time.files have certain naming convention for ex .. File1TTT.DATddmmyyyyhrsminsec File2TTT.DATddmmyyyyhrsminsec I want to take their line count when they are formed and mail that line count. Please help how to... (2 Replies)
Discussion started by: ammbhhar
2 Replies

6. UNIX for Dummies Questions & Answers

Script to count character present in a line

Suppose i have multiple line like below in a file. ASDFAFAGAHAHAHA AGAHAHAJGAFAGAH AHAHAKAHAHAHAKA I need a bash script to count a character and also Also count the number of character present in each line . suppose for line 1: A=x, S=y, D=x and so on and total character=15. where x y and z is... (3 Replies)
Discussion started by: XXLMMN
3 Replies

7. Shell Programming and Scripting

How to read a file, line by line in UNIX script?

#!/bin/bash file1="yxd" for file in `cat file3.txt`; do cat $file1 | awk '{split($1,dp,"."); lend=length(dp); if(lend>2) { dom=dp"."dp; split($2,ipl,","); for(i=1; i<=length(ipl); i++) { if(ipl~/:/) { if(ipl~/:/) i++; rip=ipl; i++; raq=ipl; rtq=0; si=i+4; for(;i<si;i++) rtq+=ipl; rsub="";... (2 Replies)
Discussion started by: veeruasu
2 Replies

8. Shell Programming and Scripting

To take line count from a file

Hi guys, I am having a file which where i need to take line count based on searching a particular string from a list say list_file.txt which occurs in 2nd column of my main file and to take the line count which doesnot exist in list file say list_file.txt for eg: my main file looks like this... (4 Replies)
Discussion started by: rohit_shinez
4 Replies

9. UNIX for Beginners Questions & Answers

UNIX script to check word count of each word in file

I am trying to figure out to find word count of each word from my file sample file hi how are you hi are you ok sample out put hi 1 how 1 are 1 you 1 hi 1 are 1 you 1 ok 1 wc -l filename is not helping , i think we will have to split the lines and count and then print and also... (4 Replies)
Discussion started by: mirwasim
4 Replies

10. Shell Programming and Scripting

Shell script UNIX to read text file line by line

i have a text file as belows, it includes 2 columns, 1st is the column name, 2nd is the file_name data_file.txt column_name file_name col1 file1 col2 file2 col3 file1 col4 file1 col5 file2 now, i would like to... (4 Replies)
Discussion started by: tester111
4 Replies
Perlbal::Test(3pm)					User Contributed Perl Documentation					Perlbal::Test(3pm)

NAME
Perlbal::Test - Test harness for perlbal server SYNOPSIS
# my $msock = Perlbal::Test::start_server(); DESCRIPTION
Perlbal::Test provides access to a perlbal server running on the local host, for testing purposes. The server can be an already-existing server, a child process, or the current process. Various functions are provided to interact with the server. FUNCTIONS
mgmt_port() Return the current management port number. dump_res($http_response) Return a readable string formatted from an HTTP::Response object. Only the first 80 characters of returned content are returned. tempdir() Return a newly created temporary directory. The directory will be removed automatically upon program exit. new_port() Return the next free port number in the series. Port numbers are assigned starting at 60000. test_port() Return 1 if the port is free to use for listening on $free_port else return 0. filecontent($file>; Return a string containing the contents of the file $file. If $file cannot be opened, then return undef. foreach_aio($callback) Set the server into each AIO mode (none, ioaio) and call the specified callback function with the mode name as argument. manage($cmd, %opts) Send a command $cmd to the server, and return the response line from the server. Optional arguments are: quiet_failure => 1 Output a warning if the response indicated an error, unless $opts{quiet_failure} is true, or the command was 'shutdown' (which doesn't return a response). manage_multi($cmd) Send a command $cmd to the server, and return a multi-line response. Return the number zero if there was an error or no response. start_server($conf) Optionally start a perlbal server and return a socket connected to its management port. The argument $conf is a string specifying initial configuration commands. If the environment variable TEST_PERLBAL_FOREGROUND is set to a true value then a server will be started in the foreground, in which case this function does not return. When the server function finishes, exit() will be called to terminate the process. If the environment variable TEST_PERLBAL_USE_EXISTING is set to a true value then a socket will be returned which is connected to an existing server's management port. Otherwise, a child process is forked and a socket is returned which is connected to the child's management port. The management port is assigned automatically, a new port number each time this function is called. The starting port number is 60000. msock() Return a reference to the socket connected to the server's management port. ua() Return a new instance of LWP::UserAgent. wait_on_child($pid, $port) Return a socket which is connected to a child process. $pid specifies the child process id, and $port is the port number on which the child is listening. Several attempts are made; if the child dies or a connection cannot be made within 5 seconds then this function dies with an error message. resp_from_sock($sock) Read an HTTP response from a socket and return it as an HTTP::Response object In scalar mode, return only the $http_response object. In array mode, return an array of ($http_response, $firstline) where $firstline is the first line read from the socket, for example: "HTTP/1.1 200 OK" perl v5.14.2 2012-02-06 Perlbal::Test(3pm)
All times are GMT -4. The time now is 11:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy