Sponsored Content
Top Forums Shell Programming and Scripting Awk:String search more than one time and capture OP Post 302936841 by jaydeep_sadaria on Saturday 28th of February 2015 10:06:23 AM
Old 02-28-2015
Thanks for reply. But i am getting error in same.

However i had make some what simple by converting IP file as below by sorting and awk option.
In same i need to check if 3rd column is "M" in firest line and "*" in next line then i need both line OP in single line and if after reading "M" in third column i cant find "*" in next line just put remark"site down"

Suggest for same.

IP file:
Code:
2015-02-28 10:10:17 M KDA003X
2015-02-28 10:12:06 * KDA003X
2015-02-28 10:16:50 M KDA003X
2015-02-28 10:10:17 M KDA003Y
2015-02-28 10:12:06 * KDA003Y
2015-02-28 10:16:50 M KDA003Y
2015-02-28 10:10:17 M KDA003Z
2015-02-28 10:12:06 * KDA003Z
2015-02-28 10:16:50 M KDA003Z
2015-02-28 10:10:15 M RTE001X
2015-02-28 10:12:06 * RTE001X
2015-02-28 10:16:50 M RTE001X
2015-02-28 10:18:30 * RTE001X
2015-02-28 10:10:15 M RTE001Y
2015-02-28 10:12:06 * RTE001Y
2015-02-28 10:16:50 M RTE001Y
2015-02-28 10:18:30 * RTE001Y
2015-02-28 10:10:15 M RTE001Z
2015-02-28 10:12:06 * RTE001Z
2015-02-28 10:16:50 M RTE001Z
2015-02-28 10:18:30 * RTE001Z

Regards
Jaydeep Sadaria
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search string during a specific time frame

Can someone please help me with searching a string during a specific time frame. Below is the format of the time from my log file. "GET /AAM2009_wherewereheaded.wmv HTTP/1.1" 200 52307085 The search string I need is "AAM2009_wherewereheaded.wmv" I need to search the number of... (1 Reply)
Discussion started by: tadi18
1 Replies

2. Shell Programming and Scripting

Awk command for search a string in lspv

I want to know wich hdisk have only one pvid and also display hdisk with two pvid. hdisk1 00c3fcd4e516183f testvg active hdisk2 00c3fcd4e516189b testvg active hdisk3 00c3fcd4e51618ec testvg ... (1 Reply)
Discussion started by: khalidou13
1 Replies

3. Shell Programming and Scripting

Awk - find string, search lines below string for other strings

What's the easiest way to search a file for a specific string and then look for other instances after that? I want to search for all Virtual Hosts and print out the Server Name and Document Root (if it has that info), while discarding the rest of the info. Basically my file looks like this: ...... (6 Replies)
Discussion started by: Mbohmer
6 Replies

4. Shell Programming and Scripting

awk/sed string search and replace

Need help with either sed or awk to acheive the following file1 ----- In the amazon forest The bats eat all the time... mon tue wed they would eat berries In the tropical forest The bats eat all the time... on wed bats eat nuts In the rain forest The bats eat all the time... on... (2 Replies)
Discussion started by: jville
2 Replies

5. Shell Programming and Scripting

awk search between 2 digits a string

I would like to search between two a string. I thought this would be easy. The is always at the beginning of a line. The code: gawk '/^/{d=$1},/searchstring/,/^(d+1)/' or gawk '/^/,/searchstring/,/^/' did not return the desired result. inputfile.txt 999 some text searchstring some... (6 Replies)
Discussion started by: sdf
6 Replies

6. UNIX for Dummies Questions & Answers

Converting string date time to unix time in AWK

I'd like to convert a date string in the form of sun aug 19 09:03:10 EDT 2012, to unixtime timestamp using awk. I tried This is how each line of the file looks like, different date and time in this format Sun Aug 19 08:33:45 EDT 2012, user1(108.6.217.236) all: test on the 17th ... (2 Replies)
Discussion started by: bkkid
2 Replies

7. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

8. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies

9. Shell Programming and Scripting

awk : Search for text between two time frame (12 hours)

I have created the script to grep the errors from weblogic logs files and redirecting output to file.txt ...From file.txt I'm using awk command to collect the past 20 mins output...The script running from cron every 15 mins... The script working well... Now the challenges, I'm trying to use... (27 Replies)
Discussion started by: zenkarthi
27 Replies

10. Shell Programming and Scripting

awk help string capture

Dear All My input file as under. From it I want op fine as mention below. Kindly help. I use below code but not help. code: awk -F" " '{print $2}' ip file: "BSCJNGR_IPA17_C" 030 131207 1305 RXOCF-353 PBD011_BGIL BOTH AC FAULTY "BSCJNGR_IPA17_C" 991 131207 1637 RXOCF-224 NAV001_BGIL ... (5 Replies)
Discussion started by: jaydeep_sadaria
5 Replies
STRFRY(3)						     Linux Programmer's Manual							 STRFRY(3)

NAME
strfry - randomize a string SYNOPSIS
#define _GNU_SOURCE /* See feature_test_macros(7) */ #include <string.h> char *strfry(char *string); DESCRIPTION
The strfry() function randomizes the contents of string by using rand(3) to randomly swap characters in the string. The result is an ana- gram of string. RETURN VALUE
The strfry() functions returns a pointer to the randomized string. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------+---------------+---------+ |Interface | Attribute | Value | +----------+---------------+---------+ |strfry() | Thread safety | MT-Safe | +----------+---------------+---------+ CONFORMING TO
The strfry() function is unique to the GNU C Library. SEE ALSO
memfrob(3), string(3) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2015-03-02 STRFRY(3)
All times are GMT -4. The time now is 01:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy