Search a row


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Search a row
# 1  
Old 08-05-2013
Search a row

Hi,

I would like to capture rows having the following format :

Code:
BIND dn="uid=euser00,ou=people,o=example.com"

except "euser00" which is user id, others should remain as it is. Here is what I can try so far :

Code:
BIND dn="\s*?uid=s*

Also, people or example can be of any case ( lower or upper ).

Thanks.
# 2  
Old 08-05-2013
Which programming language are you using?
# 3  
Old 08-05-2013
Is that a regex that you ask for? Try
Code:
grep -i 'BIND dn="uid=.*,ou=people,o=example.com"' file

# 4  
Old 08-06-2013
Thanks for the response. I am in need of Regex Expression to be used within Perl.

ex :

Code:
/BIND dn="\s*?uid=s*/

# 5  
Old 08-06-2013
Code:
/BIND dn="uid=.*,ou=people,o=example\.com"/i

This User Gave Thanks to MadeInGermany For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Search and delete a row which is delimited by |^

I have a sample text file like this. CampaignId|^CampaignCd|^InsertionOrderCd|^OwningAdvertiserCd|^CampaignName 998201|^T15-06|^T15|^|^GTA 160x160 998277|^T15-07|^T15|^TEST|^GTA 160x160 998297|^T15-07|^T15|^TEST2|^GTA 160x160 I want to delete the line only when the 4th field is empty. ... (2 Replies)
Discussion started by: Tuxidow
2 Replies

2. Shell Programming and Scripting

Search pattern between two quotes and make 1 row

Hi All, My file cat file " test1 test1 " " test1 test1 test1 test1" "test1 test1 test1 test1 test1 test1 "How to achieve this i want the result: cat file test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 Please use CODE (not QUOTE) tags as required by... (4 Replies)
Discussion started by: lxdorney
4 Replies

3. Shell Programming and Scripting

Splitting single row into multiple rows based on for every 10 digits of last field of the row

Hi ALL, We have requirement in a file, i have multiple rows. Example below: Input file rows 01,1,102319,0,0,70,26,U,1,331,000000113200000011920000001212 01,1,102319,0,1,80,20,U,1,241,00000059420000006021 I need my output file should be as mentioned below. Last field should split for... (4 Replies)
Discussion started by: kotra
4 Replies

4. Shell Programming and Scripting

Add Row from First Row (Split Row)

HI Guys, I have Below Input :- RepigA_hteis522 ReptCfiEtrBsCll_aofe MSL04_MSL2_A25_1A 0 9 MSL04_MSL2_A25_1B 0 9 MSL04_MSL2_A25_1C 0 9 RepigA ReptCfiEtrBsCll hteis522 aofe MSL04_MSL2_A25_1A 0 9 MSL04_MSL2_A25_1B 0 9 MSL04_MSL2_A25_1C 0 9 Split Data in two first row... (2 Replies)
Discussion started by: pareshkp
2 Replies

5. Shell Programming and Scripting

Search/grep on row and column wise

Hello, I have a comma seperate metadata as follows: CITY ,COUNTY,STATE,COUNTRY NEW_YORK,NYC ,NY ,USA NEWARK ,ESSEX ,NJ ,USA CHICAGO ,COOK ,IL ,USA SEATTLE ,MINER ,WA ,USA In my process, I get two key values ie CITY NAME (can be one of the... (7 Replies)
Discussion started by: calredd
7 Replies

6. Shell Programming and Scripting

Search row by row from one file to another file if match is found print few colums of file 2

this is the requirement list.txt table1 table2 table3 testfile.txt name#place#data#select * from table1 name2#place2#data2#select * from table 10 innerjoin table3 name2#place2#data2#select * from table 10 output name place table1 name2 place table3 i tried using awk (7 Replies)
Discussion started by: vamsekumar
7 Replies

7. Shell Programming and Scripting

search column and delete row if greater than value

Hi, as the title states i need to find a way to search a column for values great than 1000, and if it is, then delete that row. An example 1 7.021 6.967 116.019 4 U 6.980E+07 0.000E+00 e 0 0 0 0 2 8.292 7.908 118.063 3 U 1.440E+07 0.000E+00 e 0 821 814 ... (3 Replies)
Discussion started by: olifu02
3 Replies

8. UNIX for Dummies Questions & Answers

search one row and print next 9 rows

Hi, I'd like your support on this, my file looks like this: 25 50 200 10 0 1 10 6 12 17 26 24 30 319 10 -0.83 3.31 270.646 12.48 -163.04 30.38 0 0 0 -2.88 0.64 16.06 34.4 33.08 34.4 33.08 34.06 20.48 6.22 -33.39 33.96 -33.5840381 -71.6177759 -163.26 25.59 34.1 -28.8 -5.6 -9.9 0 0 0 0... (3 Replies)
Discussion started by: Gery
3 Replies

9. Shell Programming and Scripting

Search multiple columns in each row

Hi All, I have to search in multiple columns for multiple values, if the match is found then print the values as below. Eg: cat t1 Z|VLD_AB_P|VLD_CD_P|VLD_EF_F|VLD_GH_F|100 Y|VLD_AB_F|VLD_CD_F|VLD_EF_P|VLD_GH_P|101 if then print "Invalid AB in $6" if then print "Invalid CD in... (6 Replies)
Discussion started by: gsjdrr
6 Replies

10. UNIX for Dummies Questions & Answers

Search based on 1st char of a row.

I want to search for the very first character in a row from the file. It is very similar to the way we use Mainframes File-Aid, quick search option. I couldnt find anything helpful with the grep command. Does any one has an idea, how to perform this? (6 Replies)
Discussion started by: videsh77
6 Replies
Login or Register to Ask a Question