Sponsored Content
Full Discussion: Selective grep
Top Forums Shell Programming and Scripting Selective grep Post 302643251 by anil510 on Friday 18th of May 2012 10:34:05 PM
Old 05-18-2012
Quote:
Originally Posted by balajesuri
A slight extension to guruprasadpr's solution:

Code:
grep -Eo '[[:alnum:]]*@[[:alpha:]]*(\.[a-z]{2,4})+' file

Code:
# cat  /root/gmail.txt
now_u.k12@gmail.com
c.gg@gmail.com
s_klk@gmail.com

When _ or . character is in email, it gives wrong result.
Code:
# cat /root/gmail.txt   |  grep -o '[[:alnum:]]*@gmail.com' |sort|uniq -c|sort -nk 1
      1 gg@gmail.com
      1 k12@gmail.com
      1 klk@gmail.com

How to solve this?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

echo is selective?

i tried to ask about this earlier, but didn't explain well enough. From a script, i issue the following: echo `pgp --encrypt filename --recipient public-key` The result is perfect. The encrypted file is in the directory just as if i'd issued the pgp command from the command line. However,... (0 Replies)
Discussion started by: rgard
0 Replies

2. UNIX for Advanced & Expert Users

Selective Umask

Hi, We have umask 022 in /etc/profile for security reasons. But I want have some other umask for selected users. how to achieve this? Regards (3 Replies)
Discussion started by: baanprog
3 Replies

3. IP Networking

selective masquerading

I am running Linux 2.6.20 on i686 architecture. I want to be able to masquerade different hosts on my LAN to different external interfaces. Specifically, I want one specific host to masquerade through a vpn tunnel while the other hosts simply masquerade over the regular ISP interface. I only... (4 Replies)
Discussion started by: NESter
4 Replies

4. Shell Programming and Scripting

selective printing

hi all from below text "abcd,SYS_12345,xyz,PQR, ," I want to print only "abcd,SYS,xyz,PQR, ," i.e. taking only first three 3 chars from 2 string of comma separated file thanks (4 Replies)
Discussion started by: JoeColeEPL9
4 Replies

5. UNIX for Dummies Questions & Answers

selective grep

Hello, I have been using the command below for file manipulation. while read A B; do grep $f1; done < f2 > f3 So, if a certain string is found in f2 (for ex; DOG243435) and it is also present in f1, then print that string plus the contents of the line in which it was found onto f3. ... (6 Replies)
Discussion started by: verse123
6 Replies

6. UNIX for Dummies Questions & Answers

Help with selective ls

Hi all :wall: Can anyone advise how do I use ls to do a selective amd sorted listing of file that I want to have as below? Am looking for files that are named as log_<nnnn>.txt, where <nnnn> are numeric, i.e. I want to have a listing sorted from the newest to the oldest of files that... (7 Replies)
Discussion started by: newbie_01
7 Replies

7. Shell Programming and Scripting

Selective grouping

I have a text file in this format. Group: AAA Notes: IP : 11.11.11.11 #User xxxxxxxxx #Password aaaaaaaaaaaaaaaa Group: AAA Notes: IP : 11.11.11.22 #User yyyyyyyyyyyyy #Password bbbbbbbbbbbbb (8 Replies)
Discussion started by: anil510
8 Replies

8. UNIX for Dummies Questions & Answers

Selective replace

i have a large sequence of format sat_1_g3_g_0_8540 . A 1 15501 . . . ID=sat_1_g3_g_0_8540;parentName=sat_1_g3_g_0_8540;Al=sat_1_g2_g_0_8540; sat_1_g3_g_2_8510 . C 1 25501 . . . ... (11 Replies)
Discussion started by: siya@
11 Replies

9. Shell Programming and Scripting

Selective printing

I have the following contents in a file ---- CRITICAL: altered for /usr/bin/bin1 ---- OK: /usr/sbin/bin2 result fine ---- OK: /usr/sbin/bin3 result fine ---- CRITICAL: altered for /usr/bin/bin4 ---- OK: /usr/bin/bin5 result fine ---- OK: /usr/bin/bin6 result fine ---- CRITICAL: altered for... (9 Replies)
Discussion started by: anil510
9 Replies

10. Shell Programming and Scripting

Selective running

I have MegaCli64 -PDList -aALL | grep -E 'Enclosure Device ID|Slot Number' Enclosure Device ID: 252 Slot Number: 0 Enclosure Device ID: 252 Slot Number: 1 Enclosure Device ID: 252 Slot Number: 2 Enclosure Device ID: 252 Slot Number: 3 I need to run the following command on all slots... (4 Replies)
Discussion started by: anil510
4 Replies
MODBUS_REPORT_SLAVE_(3) 					 Libmodbus Manual					   MODBUS_REPORT_SLAVE_(3)

NAME
modbus_report_slave_id - returns a description of the controller SYNOPSIS
int modbus_report_slave_id(modbus_t *ctx, uint8_t *dest); DESCRIPTION
The modbus_report_slave_id() function shall send a request to the controller to obtain a description of the controller. The response stored in dest contains: o the byte count of the response o the slave ID, this unique ID is in reality not unique at all so it's not possible to depend on it to know how the information are packed in the response. o the run indicator status (0x00 = OFF, 0xFF = ON) o additional data specific to each controller. For example, libmodbus returns the version of the library as a string. RETURN VALUE
The modbus_report_slave_id() function shall return the number of read data if successful. Otherwise it shall return -1 and set errno. EXAMPLE
uint8_t *tab_bytes; ... rc = modbus_report_slave_id(ctx, tab_bytes); if (rc > 1) { printf("Run Status Indicator: %s ", tab_bytes[1] ? "ON" : "OFF"); } AUTHORS
The libmodbus documentation was written by Stephane Raimbault <stephane.raimbault@gmail.com[1]> NOTES
1. stephane.raimbault@gmail.com mailto:stephane.raimbault@gmail.com libmodbus 3.0.3 05/26/2012 MODBUS_REPORT_SLAVE_(3)
All times are GMT -4. The time now is 04:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy