Sponsored Content
Top Forums Shell Programming and Scripting Problem using egrep: spaces and newline Post 302336492 by vgersh99 on Wednesday 22nd of July 2009 09:03:38 AM
Old 07-22-2009
Quote:
Originally Posted by andyu11
Thanks, I am working in bash shell scripting - sorry, I should have mentioned it earlier.

So I tried various formats of the suggestion above
Code:
OUT_FILE=$(echo ${OLD_FILE} | tr -s ' ' '^')
OUT_FILE=`$(echo ${OLD_FILE} | tr -s ' ' '^')`
OUT_FILE=$(egrep ' ' $OLD_FILE | tr -s ' ' '^')

These are a few examples of what I tried. But it did not work.

Thanks in advance.

-Andy
This is NOT what I've suggested - reread the post!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem escaping newline in ksh

Hi, I did the below. $ print "\\n" $ I am curious, why does \\n give two new lines? I would have thought that the first \ would escape the second \, and so we'd get \n printed. But we didn't. Any ideas? Thanks. (7 Replies)
Discussion started by: JamesByars
7 Replies

2. Shell Programming and Scripting

egrep understanding problem

Hi, Can anyone please let me know the meaning of this line,i am not able to understand the egrep part(egrep '^{1,2}).This will search for this combination in beginning but what does the values in {}signifies here. /bin/echo $WhenToRun | egrep '^{1,2}:$' >/dev/null (1 Reply)
Discussion started by: namishtiwari
1 Replies

3. Shell Programming and Scripting

egrep problem | printing next line?????

Hi !!! Dear People, Please help me with the following problem. consider this output: Top 5 Timed Events ~~~~~~~~~~~~ Total Event Waits Time (s) Ela Time ---------------------------- ------------ ----------- ----- CPU time ... (3 Replies)
Discussion started by: user__user3110
3 Replies

4. Shell Programming and Scripting

egrep problem

Hello Experts, I am trying to parse a gz file like this gzip -cd filename | xargs egrep -h -e '.*somepattern</TAG>' | grep -c '<TAG2>`date '+%Y-%m-%d'`</TAG2>' But I am getting an error : egrep cant open. Any ideas fellas? (1 Reply)
Discussion started by: King Nothing
1 Replies

5. Shell Programming and Scripting

Help with sed matching <tag1> newline spaces <tag2> and replace the value in the same string format

Hi, I'm very new to shell scripting and have searched google and this forum for quite some time now. I have the following in my xml file: <recipients> <member>value1</member> </recipients> I need to find a string <recipients> that follows with a new-line and bunch of spaces and... (5 Replies)
Discussion started by: mgharios
5 Replies

6. UNIX for Dummies Questions & Answers

Problem pattern redundancy with egrep

%%%%% (2 Replies)
Discussion started by: lucasvs
2 Replies

7. Shell Programming and Scripting

Problem with egrep and cat

Hello, I want to find some keywords in a dd image. I have created a keyword file (1.txt) and search the dd image using, cat /media/sdb1/test/c.dd.001 | strings | egrep -i --color -f 1.txt It works, But how can I get the file name and path? Many thanks. (7 Replies)
Discussion started by: yzy9951
7 Replies

8. Shell Programming and Scripting

Deleting newline and making output in single line with spaces

HI I have a file line vi Input 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 (7 Replies)
Discussion started by: Priya Amaresh
7 Replies

9. Shell Programming and Scripting

How to remove newline, tab, spaces in curly braces.. :( Pls Help?

Hi Everyone, in the below "xyz (Exception e)" part... after the curly braces, there is a new line and immediately few tabs are present before closing curly brace. xyz (Exception e) { } note: there can be one or more newlines between the curly braces. My desired output should be ... (6 Replies)
Discussion started by: NY_777
6 Replies

10. UNIX for Dummies Questions & Answers

Egrep problem

Hi everyone, Can someone look this over? find /oracle/diag/rdbms/*/*/trace -type f -name '*d00*.trc' -mtime 0 \ -exec egrep -c 'TNS-12535: TNS:operation timed out' '{}' '+' | awk -F: '{print $1}' | egrep -c '2015-01-22' usidp/trace/abcdef_d001_21751.trc:9 \... (1 Reply)
Discussion started by: bdby
1 Replies
ZIPGREP(1L)															       ZIPGREP(1L)

NAME
zipgrep - search files in a ZIP archive for lines matching a pattern SYNOPSIS
zipgrep [egrep_options] pattern file[.zip] [file(s) ...] [-x xfile(s) ...] DESCRIPTION
zipgrep will search files within a ZIP archive for lines matching the given string or pattern. zipgrep is a shell script and requires egrep(1) and unzip(1L) to function. Its output is identical to that of egrep(1). ARGUMENTS
pattern The pattern to be located within a ZIP archive. Any string or regular expression accepted by egrep(1) may be used. file[.zip] Path of the ZIP archive. (Wildcard expressions for the ZIP archive name are not supported.) If the literal filename is not found, the suffix .zip is appended. Note that self-extracting ZIP files are supported, as with any other ZIP archive; just specify the .exe suffix (if any) explicitly. [file(s)] An optional list of archive members to be processed, separated by spaces. If no member files are specified, all members of the ZIP archive are searched. Regular expressions (wildcards) may be used to match multiple members: * matches a sequence of 0 or more characters ? matches exactly 1 character [...] matches any single character found inside the brackets; ranges are specified by a beginning character, a hyphen, and an end- ing character. If an exclamation point or a caret (`!' or `^') follows the left bracket, then the range of characters within the brackets is complemented (that is, anything except the characters inside the brackets is considered a match). (Be sure to quote any character that might otherwise be interpreted or modified by the operating system.) [-x xfile(s)] An optional list of archive members to be excluded from processing. Since wildcard characters match directory separators (`/'), this option may be used to exclude any files that are in subdirectories. For example, ``zipgrep grumpy foo *.[ch] -x */*'' would search for the string ``grumpy'' in all C source files in the main directory of the ``foo'' archive, but none in any subdirectories. Without the -x option, all C source files in all directories within the zipfile would be searched. OPTIONS
All options prior to the ZIP archive filename are passed to egrep(1). SEE ALSO
egrep(1), unzip(1L), zip(1L), funzip(1L), zipcloak(1L), zipinfo(1L), zipnote(1L), zipsplit(1L) URL
The Info-ZIP home page is currently at http://www.info-zip.org/pub/infozip/ or ftp://ftp.info-zip.org/pub/infozip/ . AUTHORS
zipgrep was written by Jean-loup Gailly. Info-ZIP 28 February 2005 ZIPGREP(1L)
All times are GMT -4. The time now is 03:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy