Sponsored Content
Full Discussion: awk regex- include text
Top Forums Shell Programming and Scripting awk regex- include text Post 302652945 by Scott on Friday 8th of June 2012 06:39:05 AM
Old 06-08-2012
Yes, I think I misread your requirement. if( $6 == "City: " ) should do, or if( $1 ~ /City: *$/ ) is a bit more flexible.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to include 'date' in my awk?

Hi, I have problem in including date in side awk, my code as follows: performace=performace.txt reporttime=`date` cat $performace | grep "testString" | awk '{ if ($3 > 20 ){print $reporttime $1 $2 $3}}' >> $rpt $reporttime is not reflecting properly in my report file($rpt)? how to... (3 Replies)
Discussion started by: redlotus72
3 Replies

2. Shell Programming and Scripting

Include Line Before Pattern Using Sed / Awk

Hi, I have a sql file that runs something like this vi Test.sql REVOKE EXECUTE ON DEMO_USER.SQC_SAMP FROM PUBLIC; REVOKE EXECUTE ON DEMO_USER.SQC_SAMP FROM DEMO_READ; REVOKE SELECT ON DEMO_USER.DEMO_NOMINEE_TEST FROM DEMO_READ; REVOKE EXECUTE ON DEMO_USER.SQC_SAMP FROM... (3 Replies)
Discussion started by: rajan_san
3 Replies

3. Shell Programming and Scripting

Problem with sending email(to include contents of text file)

Hello, I was using a shell script for sending contents of a text file(email.report) to different users. I was using the below command in my script to send email... cat email.report | /usr/bin/mailx -s $REQ_SUBJECT -h 5 abc@xyz.com It was working fine all these days but now all of a sudden it... (18 Replies)
Discussion started by: smarty86
18 Replies

4. Shell Programming and Scripting

Selecting a part of the text (regex pattern, awk, sed)

Hello, let's start by giving you guys a few examples of the text: "READ /TEXT123/ABC123" "READ /TEXT123/ABC123/" "READ TEXT123/ABC123" "READ TEXT123/ABC123/" "READ TEXT123/TEXT456/ABC123" "READ /TEXT123/TEXT456/ABC123" "READ /TEXT123/TEXT456/ABC123/" TEXT and ABC can be and I... (5 Replies)
Discussion started by: TehOne
5 Replies

5. Shell Programming and Scripting

Need to include two more columns in the file using awk

Hi, I have a input file with many records as below: 1J4RR4GG0BC508200 68646 1 N M i want my output file to be like with columns included dgismdh and timestamp : Example: 1J4RR4GG0BC508200 68646 1 N M dgismdh 2012-02-21 07:22:25.98591 How to do it.can we do using awk? Pls help. (6 Replies)
Discussion started by: sonam273
6 Replies

6. Shell Programming and Scripting

how to include a text pattern in system function in PERL

Pleeeeease help.. I'm working in perl i have a system function to check whether a file is readable for others or not. i just want to print a text in that command my command is : system ("ls -la $filename | awk '\$1~ /^-......r../ {print \$9}'"); i know for displaying text in awk... (6 Replies)
Discussion started by: shubhamsachdeva
6 Replies

7. Shell Programming and Scripting

Include information in certain columns using grep and awk

HI all, I have data in a file that looks like this: 1 HOW _ NNP NNP _ 3 nn _ _ 2 DRUGS _ NNP NNP _ 3 nn _ _ 3 ACT _ NNP NNP _ 0 null _ _ 4 : _ ... (3 Replies)
Discussion started by: owwow14
3 Replies

8. Shell Programming and Scripting

Regex to include up to blank line.

Hi guys I am trying to figure out how to match a pattern with a regex up to a full blank line. I will show you what I mean with this example: example A movie name: ted movie name: TMNT movie name: Jinxed example B movie names: Gravity Faster Turbo song titles: dont hello problem (8 Replies)
Discussion started by: acoding
8 Replies

9. Shell Programming and Scripting

Include pathname in awk output?

I am running an awk to verify all the memory settings for tomcat, and need to include path or directory in output .... I am running: awk '{ print $3 }' /opt/dir1/dir2/*/tomcat/bin/setenv.sh Output results: -Xms1024m -Xmx1536m -Xmx1536m -Xmx1024m -Xms1024m -Xms1024m -Xms512m -Xms1024m... (3 Replies)
Discussion started by: kgolli
3 Replies

10. Shell Programming and Scripting

awk to parse field and include the text of 1 pipe in field 4

I am trying to parse the input in awk to include the |gc= in $4 but am not able to. The below is close: awk so far: awk '{sub(/\|]+]++/, ""); print }' input.txt Input chr1 955543 955763 AGRN-6|pr=2|gc=75 0 + chr1 957571 957852 AGRN-7|pr=3|gc=61.2 0 + chr1 970621 ... (7 Replies)
Discussion started by: cmccabe
7 Replies
MYSQLI_STMT_DATA_SEEK(3)						 1						  MYSQLI_STMT_DATA_SEEK(3)

mysqli_stmt::data_seek - Seeks to an arbitrary row in statement result set

       Object oriented style

SYNOPSIS
void mysqli_stmt::data_seek (int $offset) DESCRIPTION
Procedural style void mysqli_stmt_data_seek (mysqli_stmt $stmt, int $offset) Seeks to an arbitrary result pointer in the statement result set. mysqli_stmt_store_result(3) must be called prior to mysqli_stmt_data_seek(3). PARAMETERS
o $ stmt -Procedural style only: A statement identifier returned by mysqli_stmt_init(3). o $offset - Must be between zero and the total number of rows minus one (0.. mysqli_stmt_num_rows(3) - 1). RETURN VALUES
No value is returned. EXAMPLES
Example #1 Object oriented style <?php /* Open a connection */ $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $query = "SELECT Name, CountryCode FROM City ORDER BY Name"; if ($stmt = $mysqli->prepare($query)) { /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($name, $code); /* store result */ $stmt->store_result(); /* seek to row no. 400 */ $stmt->data_seek(399); /* fetch values */ $stmt->fetch(); printf ("City: %s Countrycode: %s ", $name, $code); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> Example #2 Procedural style <?php /* Open a connection */ $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $query = "SELECT Name, CountryCode FROM City ORDER BY Name"; if ($stmt = mysqli_prepare($link, $query)) { /* execute query */ mysqli_stmt_execute($stmt); /* bind result variables */ mysqli_stmt_bind_result($stmt, $name, $code); /* store result */ mysqli_stmt_store_result($stmt); /* seek to row no. 400 */ mysqli_stmt_data_seek($stmt, 399); /* fetch values */ mysqli_stmt_fetch($stmt); printf ("City: %s Countrycode: %s ", $name, $code); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> The above examples will output: City: Benin City Countrycode: NGA SEE ALSO
mysqli_prepare(3). PHP Documentation Group MYSQLI_STMT_DATA_SEEK(3)
All times are GMT -4. The time now is 04:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy