Sponsored Content
Top Forums Shell Programming and Scripting awk regex expression works in AIX but not in Linux Post 302910810 by blackrageous on Monday 28th of July 2014 10:30:51 AM
Old 07-28-2014
I get this on my Linux box, the results are actually the same, my linux system just doesn't do an actually process the new line...but the results are the same.
Code:
[josephgr@oc0887178221 ~]$ echo "Sun 12 Jul BST 2014\nSun 12 Jul 2014\nSun 12 Jul IS 2014" | awk '/(Sun)+( 12)+( Jul )+([A-Z]{3} )?(2014)/{print;}'
Sun 12 Jul BST 2014\nSun 12 Jul 2014\nSun 12 Jul IS 2014

When I do this; however, on linux...
Code:
$ echo -e "Sun 12 Jul BST 2014 \n Sun 12 Jul 2014 \n Sun 12 Jul IS 2014" | awk '/(Sun)+( 12)+( Jul )+([A-Z]{3} )?(2014)/{print}'
 Sun 12 Jul 2014

-E is the default for echo on linux and that means "disable interpretation of backslash escapes"

Code:
$ uname -a
Linux oc0887178221.ibm.com 2.6.32-431.21.1.el6.x86_64 #1 SMP Tue Jun 3 19:11:40 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regular expression (regex) required

I want to block all special characters except alphanumerics.. and "."(dot ) character currently am using // I want to even block only single dot or multiple dots.. ex: . or .............. should be blocked. please provide me the reg ex. ---------- Post updated at 05:11 AM... (10 Replies)
Discussion started by: shams11
10 Replies

2. Shell Programming and Scripting

Creating a regex expression

Good morning all!! In my code I and looking through file /etc/syslog.congf and printing every line that has /var/log in it. I need to turn the if 9$line) into a regex code instead. #!/usr/bin/perl @file= 'cat /etc/syslog.conf'; //when foreach $line (@file){ if ($line =~... (3 Replies)
Discussion started by: bigben1220
3 Replies

3. Shell Programming and Scripting

help with simple regex expression

I am trying to grep the following line in a file using a bash shell: (..) admin1::14959:::::: (..) It works with the following expression (as expected) # cat file | grep ^*:: admin1::14959:::::: but it does not work with (not expected) # cat /etc/shadow | grep ^+:: I assume the... (2 Replies)
Discussion started by: schms
2 Replies

4. Shell Programming and Scripting

awk -F works on Linux, but not on Solaris

Hello, I found this command works on Linux: $ echo `uptime` | awk -F "load average: " '{ print $2 }' 1.60, 1.53, 1.46 but got error on Solaris: $ echo `uptime` | awk -F "load average: " '{ print $2 }' awk: syntax error near line 1 awk: bailing out near line 1 $ which awk... (2 Replies)
Discussion started by: seafan
2 Replies

5. Shell Programming and Scripting

awk variables in regex expression ?

Hello, Could someone explain why this one returns nothing: $ x=/jon/ $ echo jon | awk -v xa=$x '$1~xa {print}' $ while the following works fine: $ x=jon $ echo jon | awk -v xa=$x '$1==xa {print}' $ jon and the following works fine: $ echo jon | awk '$1~/jon/ {print}' $ jon ... (3 Replies)
Discussion started by: vilius
3 Replies

6. Shell Programming and Scripting

passing a regex as variable to awk and using that as regular expression for search

Hi All, I have a sftp session log where I am transferring multi files by issuing "mput abc*.dat". The contents of the logfile is below - ################################################# Connecting to 10.75.112.194... Changing to: /home/dasd9x/testing1 sftp> mput abc*.dat Uploading... (7 Replies)
Discussion started by: k_bijitesh
7 Replies

7. UNIX for Advanced & Expert Users

awk variable regexp works in AIX but not in SunOS?

Using awk variables for regular expressions is working for me in AIX. It is failing for me in SunOS. I don't know why. Can someone explain and/or suggest a fix for the SunOS version? Here is a little test script. It runs fine in AIX: $ cat test.ksh #! /bin/ksh print "Executed on OS: $(... (6 Replies)
Discussion started by: charles_n_may
6 Replies

8. Shell Programming and Scripting

Hi im new to bash scripting I want to know what does the regex expression do ??

# check host value regex='^(||1|2|25)(\.(||1|2|25)){3}$' if ')" != "" ]; then if ]; then echo host $host not found exit 4 fi elif ]; then echo $host is an invalid host address exit 5 fi (1 Reply)
Discussion started by: kevin298
1 Replies

9. Shell Programming and Scripting

awk works on Linux but fails on Solaris

On linux i have the below command working fine. awk '/<app-deploy>/{A=1;++i} /<\/app-deploy>/{print >> "found"i".tmp";A=0} A{;print >> "found"i".tmp"}' deploy.xml But the same is failing on Solaris Output: awk: syntax error near line 1 awk: bailing out near line 1 uname -a SunOS mymac 5.10... (5 Replies)
Discussion started by: mohtashims
5 Replies

10. UNIX for Beginners Questions & Answers

Regex Expression Replace

I have a XML file where there is a tag with like <wd:address_line_1>1234 Street</wd:address_line_1> I want to replace the values "1234 Street" with "Test Data". Different people have different address lines and i want to replace with a fixed value to mask the file. I was trying to use sed... (7 Replies)
Discussion started by: dr46014
7 Replies
MAKEPATTERN(1gmt)					       Generic Mapping Tools						 MAKEPATTERN(1gmt)

NAME
makepattern - make GMT color pattern from b/w pattern or icon SYNOPSIS
makepattern 1bit.ras | iconfile -Cfr/g/b -Cbr/g/b DESCRIPTION
makepattern reads either a Sun 1-bit rasterfile OR a Sun icon file. It then accepts color choices for the foreground and background pixels and colorizes the pattern, writing it as a 8-bit Sun rasterfile on stdout. These patterns may then be used in GMT (3.1 or later) -Gp set- tings or by psimage. 1bit.ras | iconfile Either a 1-bit Sun rasterfile (standard format, no RLE) or a Sun icon file (as used in GMT 3.0). -Cf Sets the color for the foreground pixels (the ones) [black]. -Cb Sets the color for the background pixels (the zeros) [white]. WIN32 fix Since binary redirection under WIN32 does not work, you must specify the output file with -Gnewfile.ras. This option is only available under WIN32. EXAMPLES
To create a colorized red/blue 8-bit Sun rasterfile pattern from the old 3.0-style iconpattern stored in file custom.icon, run makepattern custom.icon -Cfred -Cbblue > custom.ras To create a green/blue 8-bit Sun rasterfile pattern from a 1-bit Sun raster called bits.ras, run makepattern bits.ras -Cfgreen -Cbblue > colorbits.ras SEE ALSO
GMT(1), psimage(1) GMT 4.5.7 15 Jul 2011 MAKEPATTERN(1gmt)
All times are GMT -4. The time now is 05:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy