Sponsored Content
Top Forums Shell Programming and Scripting fetch string and insert later Post 302215696 by playinmel.com on Thursday 17th of July 2008 03:32:00 AM
Old 07-17-2008
Quote:
Originally Posted by ennstate
Try something like this,

Code:
echo "Are you Bill ?" | sed 's/.* \(.*\) ?/My name is \1/g'

Thanks
Nagaraj G
Thanks, Can i just get the "name" and set it to $name , so that I can reuse $name later
 

10 More Discussions You Might Find Interesting

1. Programming

vector<string> with insert cmd

How do I correct this vector<string> insert. I am geeting segmintation dump. #include <algorithm> #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <iostream> //#include <sstream> #include <string> #include <utility> #include <vector> using... (1 Reply)
Discussion started by: photon
1 Replies

2. Shell Programming and Scripting

How to fetch variable value in if block and to compare it with certain string

Hi, I am trying to execute this command if ; then but getting error .Some problem with reteriving the value of $exception_info. Please help.Its urgent. thanks (4 Replies)
Discussion started by: khushboo
4 Replies

3. Shell Programming and Scripting

Fetch the rows with match string on a fixed lenth text file - NO delimiters

Hi I am trying to fetch the rows with match string "0000001234" Input file looks like below: 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1 09 0 XXX 0000001234 Z 1... (6 Replies)
Discussion started by: nareshk
6 Replies

4. Shell Programming and Scripting

How to fetch a string between two different strings?

Hi I am having a file with content as, <name>usrname</name> <value>ravistej</value> <name>pswd</name> <value>asdfgzxcv</value> . . . . <name>abc</name> <value>xyz</value> From this file, i want to fetch the string present between '<value>' and '</value>' and store the values into... (9 Replies)
Discussion started by: tejastrikez
9 Replies

5. Shell Programming and Scripting

Cut & Fetch word from string

I have a file with some SQL query, I want to fetch only Table Name from that file line by line. INPUT FILE SELECT * FROM $SCHM.TABLENAME1; ALTER TABLE $SCHM.TABLENAME1 ADD DateOfBirth date; INSERT INTO $SCHM.TABLENAME1 (CustomerName, Country) SELECT SupplierName, Country FROM $SCHM.TABLENAME2... (2 Replies)
Discussion started by: Pratik Majithia
2 Replies

6. Shell Programming and Scripting

Need to insert a comment string

I need to insert a comment string to a couple of fields for every line in the file. Different comment string for each field. In below file, fields 7 and 8 "R","1","t0000684","","10/31/2013","10/31/2013","","","","750.23"... (6 Replies)
Discussion started by: Melah Gindi
6 Replies

7. Shell Programming and Scripting

Fetch Valid String

Hi All, How to fetch the particular row based on my search command. For example Source Column Column A Column B 001,56123456 002,57123456 003,123456 Expected Output: 003,123456 To get this output I tried below mentioned function grep '123456' filename.txt (4 Replies)
Discussion started by: suresh_target
4 Replies

8. Shell Programming and Scripting

Insert String every n lines, resetting line counter at desired string

I need to read a text file and insert a string every n lines, but also have the line counter restart when I come across a header string. Line repeating working every 3 lines using code: sed '0~3 s/$/\nINSERT/g' < INPUT/PATH/FILE_NAME.txt > OUTPUT/PATH/FILE_NAME.txt I cannot seem to find... (1 Reply)
Discussion started by: Skonectthedots
1 Replies

9. UNIX for Beginners Questions & Answers

To Fetch values from String

Dears, I have string like below in my csv file <someTechnicalDetails><someTechnicalDetails>HSI</someTechnicalDetails,1234564 <someTechnicalDetails><someTechnicalDetails>Voice</someTechnicalDeta,12345673 <someTechnicalDetails><someTechnicalDetails>IPTV</someTechnicalDetai,12345673 and I... (2 Replies)
Discussion started by: mirwasim
2 Replies

10. Shell Programming and Scripting

Insert a user input string after matched string in file

i am having file like this #!/bin/bash read -p 'Username: ' uservar match='<color="red" />' text='this is only a test so please be patient <color="red" />' echo "$text" | sed "s/$match/&$uservar\g" so desireble output what i want is if user type MARIA this is only a test so please... (13 Replies)
Discussion started by: tomislav91
13 Replies
PDOSTATEMENT.SETFETCHMODE(3)						 1					      PDOSTATEMENT.SETFETCHMODE(3)

PDOStatement::setFetchMode - Set the default fetch mode for this statement

SYNOPSIS
public bool PDOStatement::setFetchMode (int $mode) DESCRIPTION
bool PDOStatement::setFetchMode (int $PDO::FETCH_COLUMN, int $colno) bool PDOStatement::setFetchMode (int $PDO::FETCH_CLASS, string $classname, array $ctorargs) bool PDOStatement::setFetchMode (int $PDO::FETCH_INTO, object $object) PARAMETERS
o $mode - The fetch mode must be one of the PDO::FETCH_* constants. o $colno - Column number. o $classname - Class name. o $ctorargs - Constructor arguments. o $object - Object. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Setting the fetch mode The following example demonstrates how PDOStatement.setFetchMode(3) changes the default fetch mode for a PDOStatement object. <?php $sql = 'SELECT name, colour, calories FROM fruit'; try { $stmt = $dbh->query($sql); $result = $stmt->setFetchMode(PDO::FETCH_NUM); while ($row = $stmt->fetch()) { print $row[0] . " " . $row[1] . " " . $row[2] . " "; } } catch (PDOException $e) { print $e->getMessage(); } ?> The above example will output: apple red 150 banana yellow 250 orange orange 300 kiwi brown 75 lemon yellow 25 pear green 150 watermelon pink 90 PHP Documentation Group PDOSTATEMENT.SETFETCHMODE(3)
All times are GMT -4. The time now is 04:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy