Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Capturing some data from a file into a variable Post 302076857 by vino on Friday 16th of June 2006 06:46:47 AM
Old 06-16-2006
A workaround

Code:
#! /bin/sh

val=\
"a      b       c       trk_012345678"
echo "$val"
num=${val##*_}
rest=${val%$num}
final=`expr $num + 1 `
if [[ ${#num} > ${#final} ]] ; then
echo "$rest"0"$final"
else
echo "$rest$final"
fi ;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capturing value into variable

Hi, I am new to shell scripting, I am trying to write a shell script, which will automate the process of mailing the invoices at the end of the day. For major part I am using Oracle database function. The problem is I want to capture the value returned by the Oracle function into the script... (2 Replies)
Discussion started by: prasad01
2 Replies

2. Shell Programming and Scripting

Capturing Unix Traceroute data

Hi guys, I need a way to capture the host on the next-to-last hop in a traceroute output. The last output is the destination but I need to capture the router just before the last hop. I can do this in perl but I'm not so sure about Shell... I'm on AIX 5.3 using ksh any ideas? ... (3 Replies)
Discussion started by: TivoliGUY
3 Replies

3. Shell Programming and Scripting

capturing the o/p to a variable

Hi, #Script mentioned below txt=($(echo `./demo1.sh`)) p=0 for p in "$txt" do col=($(./generateTable /import/data01/sri/Developer/SqlReport/Lab/23/${var} "$p")) . . . . done o/p displayed upon executing a script called "demo1.sh" is as below(two seperate lines):... (2 Replies)
Discussion started by: villain41
2 Replies

4. UNIX for Dummies Questions & Answers

Capturing a value in to variable.

Hi, I currently have a shell script where it captures in the value in to 'TOTAL' and outputs to a file, i want to capture another value of a query in to another variable and output it. Current script: sqlplus -s $user <<EOD | read TOTAL set heading off set pages 0 set feedback off set... (1 Reply)
Discussion started by: ravi0435
1 Replies

5. Shell Programming and Scripting

Capturing Particular Data

Hi everyone! Can any one help me out regarding capturing relevant data from a file. For e.g, if i want to capture the comment written after "Prompt:" for a particular date, like for this case what would be the command to capture the tag written after "Prompt:" for Date: 2009-03-20. A... (7 Replies)
Discussion started by: muhmsida
7 Replies

6. Shell Programming and Scripting

capturing a file to store in a variable

I have a file in a windows directory the file is delivery to us like this 07210900.dat where 07210900 is the current date. If I want to store that file in a variable UpLoadFileName and rename, so I can Ftp later to a UNIX directory, I am doing this, is this correct? CDRemoteDir='cd... (0 Replies)
Discussion started by: rechever
0 Replies

7. Shell Programming and Scripting

Capturing data between patterns

Hii, Friends, I want your help in one of my problem. My problem is as follows. I have a flat file as follows (Just a sample) MHT011 01(DOT)8750707asdfas8609 03(DOT)ASD3453ASD 09(DOT)876JHT87 11(DOT)sfd324ert TTT077 01(MOB)876786klj897 06(MOB)876JHT87 07(MOB)sfd324ert... (4 Replies)
Discussion started by: anushree.a
4 Replies

8. Red Hat

capturing data of nethogs

I have installed nethogs to see which process is sending load on the network. i would like to know how can i capture its data in a log file. Or is there is a unix command like script or tee which can help me to capture the data using cronjob (0 Replies)
Discussion started by: anshus1
0 Replies

9. Shell Programming and Scripting

capturing selective data from a vcd file

Hi, This is a vcd file.A vcd file may have 'n' modules. 1) I need to capture the data in bold,i.e. the module names (shown in bold) 2) Also i need to capture the data inside each individual module,say for tst_bench_top ,i need to capture data from line 4 to line 20 ... I just want one... (2 Replies)
Discussion started by: veerabahu
2 Replies

10. Shell Programming and Scripting

Perl : not capturing all the data from excel sheet

Hi folks, I am working on assignment that captures all the records(2 columns one column contains names and other contain date of birth) from excel sheet stored in a directory and checks for current date and month. If it matches current date and month then the matched records are printed as... (1 Reply)
Discussion started by: giridhar276
1 Replies
IMAP_THREAD(3)								 1							    IMAP_THREAD(3)

imap_thread - Returns a tree of threaded message

SYNOPSIS
array imap_thread (resource $imap_stream, [int $options = SE_FREE]) DESCRIPTION
Gets a tree of a threaded message. PARAMETERS
o $ imap_stream -An IMAP stream returned by imap_open(3). o $options - RETURN VALUES
imap_thread(3) returns an associative array containing a tree of messages threaded by REFERENCES, or FALSE on error. Every message in the current mailbox will be represented by three entries in the resulting array: o$thread["XX.num"] - current message number o$thread["XX.next"] o$thread["XX.branch"] EXAMPLES
Example #1 imap_thread(3) Example <?php // Here we're outputting the threads of a newsgroup, in HTML $nntp = imap_open('{news.example.com:119/nntp}some.newsgroup', '', ''); $threads = imap_thread($nntp); foreach ($threads as $key => $val) { $tree = explode('.', $key); if ($tree[1] == 'num') { $header = imap_headerinfo($nntp, $val); echo "<ul> <li>" . $header->fromaddress . " "; } elseif ($tree[1] == 'branch') { echo " </li> </ul> "; } } imap_close($nntp); ?> PHP Documentation Group IMAP_THREAD(3)
All times are GMT -4. The time now is 08:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy