LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 05:08 AM   #16
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191

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, 05: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 05:26 AM.
 
Old 06-25-2013, 05:47 AM   #18
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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, 05:53 AM   #19
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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, 07:33 AM   #20
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
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



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 01:17 PM
linux grep or awk command - how to search for string + execute couta Linux - Newbie 10 09-03-2011 01:58 AM
[SOLVED] Using grep / awk to search for coloured text s7upify Linux - General 5 09-21-2010 11:00 AM
Sed, Awk, grep,Search,delete joyds219 Linux - Newbie 6 04-03-2008 06:15 AM
How to deal with SSHD invalid user XXXX from www.xxx.yyy.xxx 1kyle SUSE / openSUSE 1 09-30-2006 05:26 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:26 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
Open Source Consulting | Domain Registration