Sponsored Content
Top Forums Shell Programming and Scripting Search complicated strings on file Post 302419770 by Scott on Saturday 8th of May 2010 02:24:22 PM
Old 05-08-2010
Your strings are not that complicated!

Code:
/Users/scott/scripts/tmp $ awk '/^(mai|sim)/' file1
mai.lim.13_60.colorValidationResponse
sim.nam.13_60.colorValidationResponse
sim.lim.12_80.colorValidationResponse
sim.lim.13_60.colorValidationRequest
sim.lim.14_90.colorValidationResponse
sim.nam.13_60.colorValidationResponse
/Users/scott/scripts/tmp $ grep -E 'mai|sim' file1     
mai.lim.13_60.colorValidationResponse
sim.nam.13_60.colorValidationResponse
sim.lim.12_80.colorValidationResponse
sim.lim.13_60.colorValidationRequest
sim.lim.14_90.colorValidationResponse
sim.nam.13_60.colorValidationResponse

gets all the strings you need. What you mean by "1st output", "2nd output", etc. could use some explaining Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find information from complicated strings

Hi experts, I have the file with these lines: var1=thu_13:12:32,var2=Microsoft,var3=240ms,var4=Mozilla/4.0_(sun;_MSIR_3-4;_windows.;_NET_1.1323.53 var1=thu_13:13:32,var2=Microsoft,var3=213ms,var4=Mozilla/4.0_(sun;_MSIR_3-4;_windows.;_NET_1.1323.53... (9 Replies)
Discussion started by: lalelle
9 Replies

2. Shell Programming and Scripting

How to search multiple strings in a file

Hi All, I want to search all the ksh scripts that has following details. 1. Search for "exit 0" 2. Search for "sqlldr" or sqlplus" 3. In the above files i want to search for all the script that has no "case" in it. Please advice. Thanks, Deep (2 Replies)
Discussion started by: deepakpv
2 Replies

3. Shell Programming and Scripting

complicated search within file

Hi, I have following problem. I have a file with time stamps and some data describing what happened between time stamps. Something like this: 10:00 meeting with K meeting with L 11:00 lunch 12:00 work with K 13:00 From this file I have to get a file with... (7 Replies)
Discussion started by: mmike
7 Replies

4. Shell Programming and Scripting

search file between last occurence of 2 strings

I need to extract the last block of /== START OF SQLPLUS ==/ and /== END OF SQLPLUS ==/. The logifle is written to several times in a day using >> to append. I need a solution using grep/sed. logfile looks like this START OF LOGFILE /== START OF SQLPLUS ==/ ERROR /== END OF SQLPLUS... (5 Replies)
Discussion started by: hanton
5 Replies

5. Emergency UNIX and Linux Support

Complicated SED search required

Hi All, I'm trying to extract all the description fields from a MIB file which contain multiple instances of the following text: ENTERPRISE compaq VARIABLES { sysName, cpqHoTrapFlags, cpqSsBoxCntlrHwLocation, cpqSsBoxCntlrIndex, cpqSsBoxBusIndex,... (10 Replies)
Discussion started by: badoshi
10 Replies

6. Shell Programming and Scripting

Script Search replace - complicated

I have a text file for which i need a script which does some fancy search and replace. Basically i want to loop through each line, if i find an occurance of certain string format then i want to carry on search on replace another line, once i replaced this line i will contine to search for the... (7 Replies)
Discussion started by: kelseyh
7 Replies

7. Shell Programming and Scripting

Search multiple Strings in a File

Hi I want to search multiple strings in a file . But the search should start with "From" Keyword and end with before "Where" keyword. Please suggest me. Thanks (2 Replies)
Discussion started by: sboss
2 Replies

8. Shell Programming and Scripting

Extended replacing of nonspecific strings in text files [beware complicated !]

Well, to make another post at this helpful forum :b::D: I recently tried something like this, I want to replace all those numberings/letters that are located between <string>file://localhost/var/mobile/Applications/ and /Documents/</string> numberings =---- replace with: first... (6 Replies)
Discussion started by: pasc
6 Replies

9. Shell Programming and Scripting

Search strings from array in second file

I have a file search_strings.txt filled with search strings which have a blank in between and look like this: S. g. Erh. o. J. v. d. Chijs g. Ehr.I would like to search the strings in the second given Textfile.txt and it shall return the column number. Can anybody help with the correct... (3 Replies)
Discussion started by: sdf
3 Replies

10. Shell Programming and Scripting

Read in search strings from text file, search for string in second text file and output to CSV

Hi guys, I have a text file named file1.txt that is formatted like this: 001 , ID , 20000 002 , Name , Brandon 003 , Phone_Number , 616-234-1999 004 , SSNumber , 234-23-234 005 , Model , Toyota 007 , Engine ,V8 008 , GPS , OFF and I have file2.txt formatted like this: ... (2 Replies)
Discussion started by: An0mander
2 Replies
RUNSIMTEST(1)						      IB MANAGEMENT SIMULATOR						     RUNSIMTEST(1)

NAME
RunSimTest - Run a test over the IB management simulator SYNOPSYS
RunSimTest [-h] [-o osm-path][-f flow-file][-c checker-file] -t topology [-n osm-node-name][-p osm-port-num][-s seed][-V verbosity-list] This command starts the simulator and runs the the given test flow on top of it. Then it runs the checker flow. The default test flow starts OpenSM and wait for Subnet-Up event. User given flow can make use of the provided facilities for starting OpenSM and tracking it events. ARGUMENTS
-t topology A topology file describing the fabric (see ibdm-topo-file) OPTIONS
-f flow-file A tcl file sourced by the sim after the fabric is setup. See following discussion about the provided API and global variables that are available for the flow. -c checker-file A tcl file defining when osm completed and what checks are requierd to validate it's outputs. The procedure named 'checker' is invoked by the test flow to start the checking flow. The default flow waits for OpenSM to complete setup the fabric and run ibdmchk. -o osm-path Full path to OpenSM (/usr/local/ofed/osm-sim/bin/opensm). NOTE OpenSM should be compiled with --with-osmv=sim to be able to connect to the simulator. -n osm-node Topology file node name the SM runs on (default H-1/U1) -p port-num Port number the SM attaches to (default 1). -s seed Random seed to be used. -V verbosity-list Module verbosity list. The first should be the global verbosity. See IBMgtSim for full list of modules. Examples: -V 0xffff = Full verbosity on all modules -V '"0x3 server 0x6f2 sma 0xffff"' = Only fatal and error for all modules full verbosity for the SMA module and default verbosity for the Server module. -h This help message AUTHOR
Eitan Zahavi, Mellanox Technologies LTD, eitan@mellanox.co.il IBMGTSIM 1.0 2008-06-16 RUNSIMTEST(1)
All times are GMT -4. The time now is 01:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy