Selecting unknown string.


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Selecting unknown string.
# 1  
Old 12-18-2001
Selecting unknown string.

Work problem:

Need to set up a job to periodically check that the number of entries in the mail queue.

I'm able to do the following: mailq | grep "Mail Queue"

Which returns: Mail Queue (7 requests)

Unfortunately I'm not sure how I select between `(` and `requests`?

TIA Smilie

Cheers,
Cameron
# 2  
Old 12-18-2001
sed 's/Mail Queue (//;s/requests)//'
# 3  
Old 12-18-2001
Pipe mailq to:

perl -ne 'if (/\((\d*?) requests/) { print $1."\n";}'
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

C: inputting string of unknown length

I realize this general issue (inputting strings of variable length in C) has been addressed in myriad locations before, but I'm interested in knowing why my specific approach is not working. (BTW I'm intentionally keeping the size increments small so that I can more easily follow what's going on.... (5 Replies)
Discussion started by: DevuanFan
5 Replies

2. Shell Programming and Scripting

Selecting tables

Hi, Can anyone help me that, How to see the table fields in Oracle database through shell script(ksh). I have tried with the following: sqlplus -s $user/$passwd@$sid << SQL >> session.log select * from Testtab.sql I'm not able to see anything.. Thanks (4 Replies)
Discussion started by: zxcjggu708
4 Replies

3. Shell Programming and Scripting

Selecting data between [ and ]

Hi Team, I am searching through log file using grep -i '<search_key>' <file_name>|awk '{print $18}' example outputs are I would like to select the data between and no other as I am getting some junk characters sometimes which chaging the o/p display format. Kindly assist.... (8 Replies)
Discussion started by: sanjaydubey2006
8 Replies

4. UNIX for Dummies Questions & Answers

Extract substring of unknown length from string

I have a string: hgLogOutput=" +0000 files: forum/web/hook-test.txt /forum/web/hook-test-2.txt description: test" and I want to extract the file names from it, they will always appear between the files: and the description:. I have worked out that I can do this: "$hgLogOutput" | awk '{... (2 Replies)
Discussion started by: klogger
2 Replies

5. Shell Programming and Scripting

Selecting a string

Hi, I have a small question... Since i am new to Unix ksh scripting i am having this problem of understanding... Well the thing is that i just want a part of a line for example Data Set=ELIG_Member_20090126.dat Count Total= 8192 Actual Total= 8187 I just want the value of Actual Total... (4 Replies)
Discussion started by: bhagya2340
4 Replies

6. Shell Programming and Scripting

selecting tokens from a string...

i store the output of ls in a variable FL $FL=`ls` $echo $FL f1.txt f2.txt f3.txt f4.txt f5.txt script.sh script.sh~ test.txt now if i want to retrive the sub-string "f1.txt" from $FL we were taught that this is what i have to do $set $FL $echo $1 f1.txt and echo $2 would give... (1 Reply)
Discussion started by: c_d
1 Replies

7. Solaris

PING - Unknown host 127.0.0.1, Unknown host localhost - Solaris 10

Hello, I have a problem - I created a chrooted jail for one user. When I'm logged in as root, everything work fine, but when I'm logged in as a chrooted user - I have many problems: 1. When I execute the command ping, I get weird results: bash-3.00$ usr/sbin/ping localhost ... (4 Replies)
Discussion started by: Przemek
4 Replies

8. Shell Programming and Scripting

searching and storing unknown number of lines based on the string with a condition

Dear friends, Please help me to resolve the problem below, I have a file with following content: date of file creation : 12 feb 2007 ==================== = name : suresh = city :mumbai #this is a blank line = date : 1st Nov 2005 ==================== few lines of some text this... (7 Replies)
Discussion started by: swamymns
7 Replies

9. Shell Programming and Scripting

perl newbie: how to extract an unknown word from a string

hi, im quite new to perl regexp. i have a problem where i want to extract a word from a given string. but the word is unknown, only fact is that it appears as the second word in the string. Eg. input string(s) : char var1 = 'A'; int var2 = 10; char *ptr; and what i want to do is... (3 Replies)
Discussion started by: wolwy_pete
3 Replies

10. Shell Programming and Scripting

Selecting a line value

Hello, I just wanted to know if there is a way in UNIX to select a line value from a list of words. there is no line number before each word, hence could not use grep. (4 Replies)
Discussion started by: unibboy
4 Replies
Login or Register to Ask a Question