Sponsored Content
Top Forums Shell Programming and Scripting Grab characters following grep Post 302437019 by Korn0474 on Tuesday 13th of July 2010 05:22:32 PM
Old 07-13-2010
Quote:
Originally Posted by anbu23
Code:
$ echo "MODStandard , Building=3A 1234, Syntax ID=3B=" | sed "s/.*Building[^,]*\([^, ]\{4\}\),.*/Building=\1/"
Building=1234

Thanks but I can't get it to function in production. Running it as:
grep Building file.dat | sed "s/.*Building[^,]*\([^, ]\{4\}\),.*/Building=\1/"

...just spits out the whole line instead of just the section like your example shows.

Am I not understanding the syntax correctly?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Grep and extract the characters after

Hi All, I have lines like below in a file A /u/ab/test1.dat A/u/ab/test2.dat A /u/bb/test3.dat A/u/cc/test4.dat I will need /u/ab/test1.dat /u/ab/test2.dat /u/bb/test3.dat /u/cc/test4.dat Pls help Thanks (6 Replies)
Discussion started by: thumsup9
6 Replies

2. UNIX Desktop Questions & Answers

grep with special characters

Hi there I need to grep for a detail from a file. The pattern to search for involves escape sequences in it. This causes for the problem. grep "P\_SOME\_STRING\_SEARCH" filename Note, I have line like below in the file and expect it to grep. select * from my_system_param ... (3 Replies)
Discussion started by: guruparan18
3 Replies

3. UNIX for Dummies Questions & Answers

Using grep to find one or more characters

Hi I am a little stuck using grep. I want to be able to find from a file all lines which have the sequence of characters t, followed by any character, followed by the characters ing. I have tried looking at the man pages for help, but did not understand it correctly (as it is not the most... (9 Replies)
Discussion started by: rushhour
9 Replies

4. UNIX for Dummies Questions & Answers

Grab Portion of Output Text (sed, grep, awk?)

Alright, here's the deal. I'm running the following ruby script (output follows): >> /Users/name/bin/acweather.rb -z 54321 -o /Users/name/bin -c Clouds AND Sun 57/33 - Mostly sunny and cool I want to just grab the "57/33" portion, but that's it. I don't want any other portion of the line. I... (5 Replies)
Discussion started by: compulsiveguile
5 Replies

5. UNIX for Dummies Questions & Answers

Is it possible to grep a certain amount of characters?

I have a file similar to the following filler filler filler car 6 mazda filler filler filler filler car civic honda car rav 4 toyota filler filler If i do a "grep -i car file.txt" the output would be car 6 mazda car civic honda car rav 4 toyota however, i want to have the... (4 Replies)
Discussion started by: jl487
4 Replies

6. Shell Programming and Scripting

Grep with special Characters

Need Help For GREP I have a file say g1.txt and content of file is below REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDrives /t REG_DWORD /d 4 /f , REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoClose /t REG_DWORD /d 1 /f ,... (4 Replies)
Discussion started by: jalpasoni
4 Replies

7. Shell Programming and Scripting

grep grab 19 letters from now or a full line

Hi, I have a file like this >hg19_chr1_123_456_+ asndbansbdahsjdbfsjhfghjdsghjdghjdjhdghjjdkhfsdkjfhdsjkdkjghkjdhgfjkhjfkf hasjgdhjsgfhjdsgfdsgfjhdgjhdjhdhjdfhjdfjgfdfbdghjbfjksdhfjsfdghjgdhjgfdjhgd jhgdfj >hg19_chr1_123_456_-... (5 Replies)
Discussion started by: jacobs.smith
5 Replies

8. Shell Programming and Scripting

grep particular characters help

Hello folks i have file which is below, i want to extract last column of file that contains dm-21 or dm-13 or dm-N it show output like I have tried but i got this (16 Replies)
Discussion started by: learnbash
16 Replies

9. Shell Programming and Scripting

Grep with ... matching more than 3 characters

I am trying to understand what the grep command in ubuntu is trying to do here. The contents of my test file is given below harsha@harsha-H67MA-USB3-B3:~/Documents$ cat data abcd efghi jklmno pqr stuv wxyz When I grep for 3 dots (...) without the parenthesis as follows I would expect the... (4 Replies)
Discussion started by: sreeharshasn
4 Replies

10. UNIX for Beginners Questions & Answers

How do I use grep to grab prime number output from my factor program?

I have a factor program that runs and outputs to stdout all the prime numbers that are specified in the given paramters, in this case 30000000-31000000. Command: factor/factor 30000000-31000000 Sample output: 30999979 = 30999979 30999980 = 2^2 5 11 140909 30999981 = 3 10333327... (6 Replies)
Discussion started by: steezuschrist96
6 Replies
PERLIRIX(1)						 Perl Programmers Reference Guide					       PERLIRIX(1)

NAME
perlirix - Perl version 5 on Irix systems DESCRIPTION
This document describes various features of Irix that will affect how Perl version 5 (hereafter just Perl) is compiled and/or runs. Building 32-bit Perl in Irix Use sh Configure -Dcc='cc -n32' to compile Perl 32-bit. Don't bother with -n32 unless you have 7.1 or later compilers (use cc -version to check). (Building 'cc -n32' is the default.) Building 64-bit Perl in Irix Use sh Configure -Dcc='cc -64' -Duse64bitint This requires require a 64-bit MIPS CPU (R8000, R10000, ...) You can also use sh Configure -Dcc='cc -64' -Duse64bitall but that makes no difference compared with the -Duse64bitint because of the "cc -64". You can also do sh Configure -Dcc='cc -n32' -Duse64bitint to use long longs for the 64-bit integer type, in case you don't have a 64-bit CPU. If you are using gcc, just sh Configure -Dcc=gcc -Duse64bitint should be enough, the Configure should automatically probe for the correct 64-bit settings. About Compiler Versions of Irix Some Irix cc versions, e.g. 7.3.1.1m (try cc -version) have been known to have issues (coredumps) when compiling perl.c. If you've used -OPT:fast_io=ON and this happens, try removing it. If that fails, or you didn't use that, then try adjusting other optimization options (-LNO, -INLINE, -O3 to -O2, etcetera). The compiler bug has been reported to SGI. (Allen Smith <easmith@beatrice.rutgers.edu>) Linker Problems in Irix If you get complaints about so_locations then search in the file hints/irix_6.sh for "lddflags" and do the suggested adjustments. (David Billinghurst <David.Billinghurst@riotinto.com.au>) Malloc in Irix Do not try to use Perl's malloc, this will lead into very mysterious errors (especially with -Duse64bitall). Building with threads in Irix Run Configure with -Duseithreads which will configure Perl with the Perl 5.8.0 "interpreter threads", see threads. For Irix 6.2 with perl threads, you have to have the following patches installed: 1404 Irix 6.2 Posix 1003.1b man pages 1645 Irix 6.2 & 6.3 POSIX header file updates 2000 Irix 6.2 Posix 1003.1b support modules 2254 Pthread library fixes 2401 6.2 all platform kernel rollup IMPORTANT: Without patch 2401, a kernel bug in Irix 6.2 will cause your machine to panic and crash when running threaded perl. Irix 6.3 and later are okay. Thanks to Hannu Napari <Hannu.Napari@hut.fi> for the IRIX pthreads patches information. Irix 5.3 While running Configure and when building, you are likely to get quite a few of these warnings: ld: The shared object /usr/lib/libm.so did not resolve any symbols. You may want to remove it from your link line. Ignore them: in IRIX 5.3 there is no way to quieten ld about this. During compilation you will see this warning from toke.c: uopt: Warning: Perl_yylex: this procedure not optimized because it exceeds size threshold; to optimize this procedure, use -Olimit option with value >= 4252. Ignore the warning. In IRIX 5.3 and with Perl 5.8.1 (Perl 5.8.0 didn't compile in IRIX 5.3) the following failures are known. Failed Test Stat Wstat Total Fail Failed List of Failed -------------------------------------------------------------------------- ../ext/List/Util/t/shuffle.t 0 139 ?? ?? % ?? ../lib/Math/Trig.t 255 65280 29 12 41.38% 24-29 ../lib/sort.t 0 138 119 72 60.50% 48-119 56 tests and 474 subtests skipped. Failed 3/811 test scripts, 99.63% okay. 78/75813 subtests failed, 99.90% okay. They are suspected to be compiler errors (at least the shuffle.t failure is known from some IRIX 6 setups) and math library errors (the Trig.t failure), but since IRIX 5 is long since end-of-lifed, further fixes for the IRIX are unlikely. If you can get gcc for 5.3, you could try that, too, since gcc in IRIX 6 is a known workaround for at least the shuffle.t and sort.t failures. AUTHOR
Jarkko Hietaniemi <jhi@iki.fi> Please report any errors, updates, or suggestions to perlbug@perl.org. perl v5.16.2 2012-10-11 PERLIRIX(1)
All times are GMT -4. The time now is 01:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy