9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi to you all,
I'm just struggling with a regex problem and I'm pretty sure that I'm missing sth obvious... :confused:
I need a regex to feed my grep in order to find lines that contain one string but not the other.
Here's the data example:
2015-04-08 19:04:55,926|xxxxxxxxxx| ... (11 Replies)
Discussion started by: stresing
11 Replies
2. Shell Programming and Scripting
Can someone please tell me what is wrong with this stings comparison?
#!/bin/sh
#set -xv
set -u
VAR=$(ping -c 5 -w 10 google.com | grep icmp_req=5 | awk '{print $6}')
echo I like cookies
echo $VAR
if "$VAR" == 'icmp_req=5'
then
echo You Rock
else
echo You Stink
fiThis is the error.... (6 Replies)
Discussion started by: cokedude
6 Replies
3. Shell Programming and Scripting
Hi again,
I'm looking for some help with nawk, I can print a line which has a regex match in it from a file using /pattern/ but I'm looking for a way to only print the $tring which contains the pattern, rather than the whole line.
This $tring may be of variable length, may occur at any point... (1 Reply)
Discussion started by: spynappels
1 Replies
4. Shell Programming and Scripting
Hi,
I've a logfile which i need to parse and get the logs depending upon the user input. here, i'm providing an option to enter the string which can be matched with the log entries.
e.g. one of the logfile entry reads like this -
$str = " mpgw(BLUESOAPFramework):... (6 Replies)
Discussion started by: butterfly20
6 Replies
5. Shell Programming and Scripting
My input contains a single word lines.
From each line
data.txt
prjtestBlaBlatestBlaBla
prjthisBlaBlathisBlaBla
prjthatBlaBladpthatBlaBla
prjgoodBlaBladpgoodBlaBla
prjgood1BlaBla123dpgood1BlaBla123
Desired output -->
data_out.txt
prjtestBlaBla
prjthisBlaBla... (8 Replies)
Discussion started by: kchinnam
8 Replies
6. Shell Programming and Scripting
Hello
I have a bash script where I need to do a substring replacement like this:
variable2=${variable1/foo/bar}
However, I only want "foo" replaced if it is at the end of the line.
However, this does not work:
variable2=${variable1/foo$/bar}
as you can see I'm using the $ regex for... (2 Replies)
Discussion started by: Ubuntu-UK
2 Replies
7. Shell Programming and Scripting
Hi there, i wonder, is it possible to use regular expressions to partially select a string?
I have a bunch of server names which look like this
server1z-test
server2z2
server45z-primary
server13z3
I want to extract up to and including the 'z' in the server name, so for example
... (4 Replies)
Discussion started by: hcclnoodles
4 Replies
8. Shell Programming and Scripting
I'm working on a basic log parser in perl. Input file looks like:
len: 120713
foo
bar
file size of: testdir1/testdir1/testdir1/testdir1/testfile0 is 120713Of course there are tens of thousands of lines... I'm trying to compare the len and filesize values.
#!/usr/bin/perl
use strict;
use... (2 Replies)
Discussion started by: dkozel
2 Replies
9. UNIX for Dummies Questions & Answers
Hi all, this is driving me nuts.
I need to evaluate if a variable in a shell script has a heading s or m character e.g. s92342394 or m9233489 if so then I need to get rid of them. I'm quite familiar with PERL and could do it there in 3 mins but I have not found a decent way to do this in a shell.... (1 Reply)
Discussion started by: Endo
1 Replies