Sponsored Content
Top Forums Shell Programming and Scripting AIX to RHEL migration - awk treating 0e[0-9]+ as 0 instead of string issue Post 302997463 by RudiC on Sunday 14th of May 2017 03:26:24 AM
Old 05-14-2017
As I said - usage alone, be it for assignment or reference in an index, takes the value as is. Only evaluation, e.g. for a boolean expression or a numerical computation, converts the string to a number, using the starting characters up to a non-convertible one.
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

AIX Migration

Hi , Migrating AIX 4.3.3 ML10 to 5.3 ML1 (retaining 32 bit) after successfully going through 5 of the 5.3 Install CD's. After "All fileset's processed successfully " message I was told that system would reboot and then I would get prompted for setting TERm type ( i have an ascii ibm3151) and... (1 Reply)
Discussion started by: Student37
1 Replies

2. Shell Programming and Scripting

awk issue on AIX

Hi, two teams at two locations - A & B. At location A, we have AIX 5.3 and at location B, we have AIX 5.1. We execute the below awk command in loc A and it executes successfully(part of a larger script). But the same does not get executed in the loc B server. We are not able to access the loc B... (1 Reply)
Discussion started by: ranj@chn
1 Replies

3. AIX

AIX 5.2 to 5.3 migration

Hello All, We want to upgrade our 44p Model 270 from AIX 5.2 to 5.3. This is a standalone devlopment server but downtime is something we don't want because we have a short development deadline looming. I have no tape drive to make backups to. I myself am a developer and don't have any... (4 Replies)
Discussion started by: Fred Vogel
4 Replies

4. AIX

IY17981 fix required for aix 4.3.3 to aix 5L migration but not found

Hi, redbook documentation is telling that IY17981 fix is required for aix 4.3.3 to aix 5L migration. But there is no mention about that fix in any ML installation packages. - My system is ML11 : oslevel –r 4330-11 - But xlC.rte is on wrong version : lslpp -L xlC.rte xlC.rte ... (3 Replies)
Discussion started by: astjen
3 Replies

5. Shell Programming and Scripting

Treating string as date ?

Is there a way to treat a string as date and compare it to the current date? lets assum inpu lik $ cat myfile Name Last login ************************** Sara 2/13/2012 kalpeer 2/15/2012 ygemici 2/14/2012 we want to display the name who logged in during the last #... (4 Replies)
Discussion started by: Sara_84
4 Replies

6. Shell Programming and Scripting

awk - treating remaining columns as one

Hi all, For no particular reason, I would like to use awk on a file that contains multiple columns, but let's say only columns 1 and 2 have some text values, and the remainder of the line contains text that I would like to treat as one column, considering I have spaces as delimiter for the... (33 Replies)
Discussion started by: ppucci
33 Replies

7. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

8. AIX

AIX - FC Switch migration, SAN Migration question!

I'm New to AIX / VIOS We're doing a FC switch cutover on an ibm device, connected via SAN. How do I tell if one path to my remote disk is lost? (aix lvm) How do I tell when my link is down on my HBA port? Appreciate your help, very much! (4 Replies)
Discussion started by: BG_JrAdmin
4 Replies

9. AIX

AIX Migration issue with EMC ODM sets

Hi Experts , I want to start migrating our AIX 6.1 to AIX 7.1 . I am planning to use alt_disk_migration . Chris gibson has awesome documentation in the internet. However I am running into an issue with EMC odm filesets . So my current OS is AIX 6.1. and I have this : lslpp -l | grep EMC ... (7 Replies)
Discussion started by: JME2015
7 Replies

10. Shell Programming and Scripting

awk treating variables differently in UNIX-Linux

Hi, awk seem to be acting differently in Unix and Linux when it comes to formatting. This is making it difficult to migrate scripts. for example: UNIX: echo "123" |awk '{printf ("%05s\n" ,$1)}' 00123 echo "123" |awk '{printf ("%05d\n" ,$1)}' 00123 echo "S12" |awk '{printf ("%05s\n"... (9 Replies)
Discussion started by: wanderingmind16
9 Replies
regexp(n)						       Tcl Built-In Commands							 regexp(n)

__________________________________________________________________________________________________________________________________________________

NAME
regexp - Match a regular expression against a string SYNOPSIS
regexp ?switches? exp string ?matchVar? ?subMatchVar subMatchVar ...? _________________________________________________________________ DESCRIPTION
Determines whether the regular expression exp matches part or all of string and returns 1 if it does, 0 if it does not, unless -inline is specified (see below). (Regular expression matching is described in the re_syntax reference page.) If additional arguments are specified after string then they are treated as the names of variables in which to return information about which part(s) of string matched exp. MatchVar will be set to the range of string that matched all of exp. The first subMatchVar will con- tain the characters in string that matched the leftmost parenthesized subexpression within exp, the next subMatchVar will contain the char- acters that matched the next parenthesized subexpression to the right in exp, and so on. If the initial arguments to regexp start with - then they are treated as switches. The following switches are currently supported: -about Instead of attempting to match the regular expression, returns a list containing information about the regular expression. The first element of the list is a subexpression count. The second element is a list of property names that describe vari- ous attributes of the regular expression. This switch is primarily intended for debugging purposes. -expanded Enables use of the expanded regular expression syntax where whitespace and comments are ignored. This is the same as speci- fying the (?x) embedded option (see the re_syntax manual page). -indices Changes what is stored in the subMatchVars. Instead of storing the matching characters from string, each variable will con- tain a list of two decimal strings giving the indices in string of the first and last characters in the matching range of characters. -line Enables newline-sensitive matching. By default, newline is a completely ordinary character with no special meaning. With this flag, "[^" bracket expressions and "." never match newline, "^" matches an empty string after any newline in addition to its normal function, and "$" matches an empty string before any newline in addition to its normal function. This flag is equivalent to specifying both -linestop and -lineanchor, or the (?n) embedded option (see the re_syntax manual page). -linestop Changes the behavior of "[^" bracket expressions and "." so that they stop at newlines. This is the same as specifying the (?p) embedded option (see the re_syntax manual page). -lineanchor Changes the behavior of "^" and "$" (the "anchors") so they match the beginning and end of a line respectively. This is the same as specifying the (?w) embedded option (see the re_syntax manual page). -nocase Causes upper-case characters in string to be treated as lower case during the matching process. -all Causes the regular expression to be matched as many times as possible in the string, returning the total number of matches found. If this is specified with match variables, they will contain information for the last match only. -inline Causes the command to return, as a list, the data that would otherwise be placed in match variables. When using -inline, match variables may not be specified. If used with -all, the list will be concatenated at each iteration, such that a flat list is always returned. For each match iteration, the command will append the overall match data, plus one element for each subexpression in the regular expression. Examples are: regexp -inline -- {w(w)} " inlined " -> in n regexp -all -inline -- {w(w)} " inlined " -> in n li i ne e -start index Specifies a character index offset into the string to start matching the regular expression at. The index value is inter- | preted in the same manner as the index argument to string index. When using this switch, "^" will not match the beginning of the line, and A will still match the start of the string at index. If -indices is specified, the indices will be indexed starting from the absolute beginning of the input string. index will be constrained to the bounds of the input string. -- Marks the end of switches. The argument following this one will be treated as exp even if it starts with a -. If there are more subMatchVars than parenthesized subexpressions within exp, or if a particular subexpression in exp does not match the string (e.g. because it was in a portion of the expression that was not matched), then the corresponding subMatchVar will be set to "-1 -1" if -indices has been specified or to an empty string otherwise. EXAMPLES
Find the first occurrence of a word starting with foo in a string that is not actually an instance of foobar, and get the letters following it up to the end of the word into a variable: regexp {mfoo(?!barM)(w*)} $string -> restOfWord Note that the whole matched substring has been placed in the variable "->", which is a name chosen to look nice given that we are not actu- ally interested in its contents. Find the index of the word badger (in any case) within a string and store that in the variable location: regexp -indices {(?i)mbadgerM} $string location This could also be written as a basic regular expression (as opposed to using the default syntax of advanced regular expressions) match by prefixing the expression with a suitable flag: regexp -indices {(?ib)<badger>} $string location This counts the number of octal digits in a string: regexp -all {[0-7]} $string This lists all words (consisting of all sequences of non-whitespace characters) in a string, and is useful as a more powerful version of the split command: regexp -all -inline {S+} $string SEE ALSO
re_syntax(n), regsub(n), string(n) | KEYWORDS
match, parsing, pattern, regular expression, splitting, string Tcl 8.3 regexp(n)
All times are GMT -4. The time now is 05:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy