LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 06-25-2013, 06:08 AM   #16
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,692

Rep: Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987

I am with druuna... not sure why you would expect something to work on completely different formatted data?

@druuna - yes the --posix or --re-interval needed on gawk prior to v4
 
Old 06-25-2013, 06:13 AM   #17
phpshell
Member
 
Registered: Nov 2012
Posts: 46

Original Poster
Rep: Reputation: Disabled
Dear Druuna
I truly appreciate your time and effort
and please be inform all the entries came as one line without \t which you thought on separate two line may its happen when i pasted here

Last edited by phpshell; 06-25-2013 at 06:26 AM.
 
Old 06-25-2013, 06:47 AM   #18
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Quote:
Originally Posted by phpshell View Post
Dear Druuna
I truly appreciate your time and effort
and please be inform all the entries came as one line without \t which you thought on separate two line may its happen when i pasted here
If that is the case (single lines), then it works.

Using your input from post #14:
Code:
$ cat infile
70430031416@tel.net.sa     GigabitEthernet 0/0.1319:1319#587205380#TYP=INT;VID=0;NBR=PE-213-01-JAWARAH-10/1##pppoe e8:39:df:7c:4a:0d#2-280-3952#                                                                                                  
          
14260852@tel.net.sa                RY-DSL-HU03#7/0/0#MV120-00-348-DSWD9-D atm 1/1/08/20:0.35#tel.net.sa#5898-35ea-4d90#11-426-0852#                                                                                                                       
          
112788297@tel.net.sa               #ry-dsl-e9#MV172-00-309-UKALC-D atm 1/1/01/10:0.35#11-278-8297                            
                                                                                                                             
          
38406442@tel.net.sa                RY-DSL-HU02#1/0/0#AlJalawyah_JLWHEAAE-A_HiX5635_11_13#tel.net.sa#0025-69ae-60b3#3-840-6442#                                                                                                                            
          
26735218@tel.net.sa                GigabitEthernet 10/0.1788:1788#587205875#TYP=INT;VID=0;NBR=PE-209-01-MUSHRIFAH-10/0/18##pppoe 00:24:d2:73:de:c6#2-673-5218#                                                                                            
          
48402264@tel.net.sa                #jd-dsl-e6#IP422AALI-D atm 1/1/06/28:0.35#4-840-2264

$ awk --posix '/[0-9]{1,2}-[0-9]{3}-[0-9]{4}/ { gsub(/#/," ") ; print $1, $NF }' infile
70430031416@tel.net.sa 2-280-3952
14260852@tel.net.sa 11-426-0852
112788297@tel.net.sa 11-278-8297
38406442@tel.net.sa 3-840-6442
26735218@tel.net.sa 2-673-5218
48402264@tel.net.sa 4-840-2264
 
Old 06-25-2013, 06:53 AM   #19
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Quote:
Originally Posted by grail View Post
@druuna - yes the --posix or --re-interval needed on gawk prior to v4
I expected as much.

Thanks for the confirmation!
 
Old 06-25-2013, 08:33 AM   #20
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,692

Rep: Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987
No probs ... must be time you upgraded .. lol

My version works but assumes white space or # after last entry, so last line would need something like it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strongbolt host xxxx.xxx 2(servfail) inv|s|ble Linux - Networking 2 11-10-2011 02:17 PM
linux grep or awk command - how to search for string + execute couta Linux - Newbie 10 09-03-2011 02:58 AM
[SOLVED] Using grep / awk to search for coloured text s7upify Linux - General 5 09-21-2010 12:00 PM
Sed, Awk, grep,Search,delete joyds219 Linux - Newbie 6 04-03-2008 07:15 AM
How to deal with SSHD invalid user XXXX from www.xxx.yyy.xxx 1kyle Suse/Novell 1 09-30-2006 06:26 AM


All times are GMT -5. The time now is 06:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration