Sponsored Content
Top Forums Shell Programming and Scripting problems egreging for a '(0)' string Post 97881 by m223464 on Friday 3rd of February 2006 05:59:54 AM
Old 02-03-2006
problems egreging for a '(0)' string

Hi,

I'm trying to egreg for a couple strings whcih are (0) and SYSTEM. The problem is the syntax for egreg is:

egreg "(string1|string2)"

With my basic knowledge of UNIX I don't know how to include '(0)' within "(string1|string2)" apart from trying to use single quotes which doesn't work, i.e. "('(0)')".

I reckon this must be eary to resolve but need some expert advice.

Can anyone help?

Gareth
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

variable= 'cat file|wc -l' String problems

Hi, does anybody knows about wc -l, how to transform it inot a just number? this script ALWAYS executes the command3!!, However, the value of BMU_RUNNING is 1 case $BMU_RUNNING in *0) command1 ;; *1) command 2;; *)command 3;; esac The... (3 Replies)
Discussion started by: Santiago
3 Replies

2. Shell Programming and Scripting

find: problems escaping printf-command string

Hi Folks! Can you help me with this find -printf command. I seem to be unable to execute the printf-command from my shell script. I'm confused: :confused: My shell script snippet looks like this: #!/bin/sh .. COMMAND="find ./* -printf '%p %m %s %u %g \n'" echo "Command: ${COMMAND}"... (1 Reply)
Discussion started by: grahamb
1 Replies

3. Shell Programming and Scripting

awk: split a file using a string problems

Hi, if i use this code awk '/String/{n++}{print > f n}' f=file input I get "input" splited this way file1 String 1515 1354 2356 file 2 String 4531 0345 5345 (3 Replies)
Discussion started by: aloctavodia
3 Replies

4. Shell Programming and Scripting

problems getting a segment from a string output

Hi I'm creating a script that creates files from svn checkout and compress them using tar.gz the script gets the repository name from command line argument i need to capture a number from the last line of the output and create a file name from it. the svn returns output of all the file... (5 Replies)
Discussion started by: tzvio
5 Replies

5. Shell Programming and Scripting

String concatenation problems

#! /bin/csh set tt=12345_UMR_BH452_3_2.txt set rr=`echo $tt | cut -d_ -f1` set rr1=welcome set ff=$rr $rr1 echo $ff why $ff returned only 12345 and not 12345welcome? thanks (2 Replies)
Discussion started by: jdsignature88
2 Replies

6. Shell Programming and Scripting

SED delete string from till problems

Hi i have a file which contains 2 lines, line 1 is static data. line 2 is a very large string(over 3000char or much more). in that string are tags which i want to delete. e.g. <order1>123</order1><tag1>data</tag1><new>1</new><order2>124</order2><tag1>data</tag1> all one one line. now i... (5 Replies)
Discussion started by: subby80
5 Replies

7. Shell Programming and Scripting

Problems assigning a string to a variable

Hello everyone, My problem looks quite simple , how to assign a string with spaces and lines "\n" to a variable. I've tried all kind of quoting and is impossible, bash always try to execute the string and never executes a simple assignation. This is part of the code ... (1 Reply)
Discussion started by: trutoman
1 Replies

8. Shell Programming and Scripting

String comparison problems

Req: =========== 1)I have one shell script a.sh 2)I opened Putty session , with user name = SIR100 , and i ran a.sh script in back ground and it took 5 minutes to complete.Meanwhile,i ran same script second time i.e a.sh with same user it sholud not allow to run the script , but it's... (3 Replies)
Discussion started by: as234301
3 Replies

9. Shell Programming and Scripting

Problems with Multiple Pattern String Matching

I am facing a problem and I would be grateful if you can help me :wall: I have a list of words like And I have a datafile like the box of the box of tissues out of of tissues out of the book, the the book, the pen and the the pen and the I want to find Patterns of “x.*x” where... (2 Replies)
Discussion started by: A-V
2 Replies

10. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
TR(1)							    BSD General Commands Manual 						     TR(1)

NAME
tr -- translate characters SYNOPSIS
tr [-Ccsu] string1 string2 tr [-Ccu] -d string1 tr [-Ccu] -s string1 tr [-Ccu] -ds string1 string2 DESCRIPTION
The tr utility copies the standard input to the standard output with substitution or deletion of selected characters. The following options are available: -C Complement the set of characters in string1, that is ``-C ab'' includes every character except for ``a'' and ``b''. -c Same as -C but complement the set of byte values in string1. -d Delete characters in string1 from the input. -s Squeeze multiple occurrences of the characters listed in the last operand (either string1 or string2) in the input into a single instance of the character. This occurs after all deletion and translation is completed. -u Guarantee that any output is unbuffered. In the first synopsis form, the characters in string1 are translated into the characters in string2 where the first character in string1 is translated into the first character in string2 and so on. If string1 is longer than string2, the last character found in string2 is dupli- cated until string1 is exhausted. In the second synopsis form, the characters in string1 are deleted from the input. In the third synopsis form, the characters in string1 are compressed as described for the -s option. In the fourth synopsis form, the characters in string1 are deleted from the input, and the characters in string2 are compressed as described for the -s option. The following conventions can be used in string1 and string2 to specify sets of characters: character Any character not described by one of the following conventions represents itself. octal A backslash followed by 1, 2 or 3 octal digits represents a character with that encoded value. To follow an octal sequence with a digit as a character, left zero-pad the octal sequence to the full 3 octal digits. character A backslash followed by certain special characters maps to special values. a <alert character>  <backspace> f <form-feed> <newline> <carriage return> <tab> v <vertical tab> A backslash followed by any other character maps to that character. c-c Represents the range of characters between the range endpoints, inclusively. [:class:] Represents all characters belonging to the defined character class. Class names are: alnum <alphanumeric characters> alpha <alphabetic characters> cntrl <control characters> digit <numeric characters> graph <graphic characters> lower <lower-case alphabetic characters> print <printable characters> punct <punctuation characters> space <space characters> upper <upper-case characters> xdigit <hexadecimal characters> With the exception of the ``upper'' and ``lower'' classes, characters in the classes are in unspecified order. In the ``upper'' and ``lower'' classes, characters are entered in ascending order. For specific information as to which ASCII characters are included in these classes, see ctype(3) and related manual pages. [=equiv=] Represents all characters belonging to the same equivalence class as equiv, ordered by their encoded values. [#*n] Represents n repeated occurrences of the character represented by #. This expression is only valid when it occurs in string2. If n is omitted or is zero, it is be interpreted as large enough to extend string2 sequence to the length of string1. If n has a leading zero, it is interpreted as an octal value, otherwise, it's interpreted as a decimal value. ENVIRONMENT
The LANG, LC_ALL, LC_CTYPE and LC_COLLATE environment variables affect the execution of tr as described in environ(7). EXAMPLES
The following examples are shown as given to the shell: Create a list of the words in file1, one per line, where a word is taken to be a maximal string of letters. tr -cs "[:alpha:]" " " < file1 Translate the contents of file1 to upper-case. tr "[:lower:]" "[:upper:]" < file1 Strip out non-printable characters from file1. tr -cd "[:print:]" < file1 Remove diacritical marks from all accented variants of the letter 'e': tr "[=e=]" "e" DIAGNOSTICS
The tr utility exits 0 on success, and >0 if an error occurs. COMPATIBILITY
System V has historically implemented character ranges using the syntax ``[c-c]'' instead of the ``c-c'' used by historic BSD implementations and standardized by POSIX. System V shell scripts should work under this implementation as long as the range is intended to map in another range, i.e. the command ``tr [a-z] [A-Z]'' will work as it will map the ``['' character in string1 to the ``['' character in string2. How- ever, if the shell script is deleting or squeezing characters as in the command ``tr -d [a-z]'', the characters ``['' and ``]'' will be included in the deletion or compression list which would not have happened under an historic System V implementation. Additionally, any scripts that depended on the sequence ``a-z'' to represent the three characters ``a'', ``-'' and ``z'' will have to be rewritten as ``a-z''. The tr utility has historically not permitted the manipulation of NUL bytes in its input and, additionally, stripped NUL's from its input stream. This implementation has removed this behavior as a bug. The tr utility has historically been extremely forgiving of syntax errors, for example, the -c and -s options were ignored unless two strings were specified. This implementation will not permit illegal syntax. STANDARDS
The tr utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). It should be noted that the feature wherein the last character of string2 is duplicated if string2 has less characters than string1 is per- mitted by POSIX but is not required. Shell scripts attempting to be portable to other POSIX systems should use the ``[#*]'' convention instead of relying on this behavior. The -u option is an extension to the IEEE Std 1003.1-2001 (``POSIX.1'') standard. BSD
October 11, 1997 BSD
All times are GMT -4. The time now is 12:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy