General :: Grep A String Like "ab?c12345678" Where 3rd Character Is Unknown While Other Characters Are Known?

May 7, 2011

How to grep a string like "ab?c12345678" where 3rd character is unknown, while other characters are known.

View 2 Replies


ADVERTISEMENT

General :: Special Character In String Variable And Grep

Apr 11, 2011

I want to match some filename in some text, but the filenames I have no control of, so "[" can "]" can appear in the filenames.so do I always have to use sed to addslashes to these variables before I have to grep them? and what other characters have I missed other than "[", "]", "."?

View 4 Replies View Related

General :: Using Grep With Accent Character Present

Jul 7, 2011

I am filtering some output from gcc with grep. But if the output contains the accent character (`) I run into a problem.Then I have to press ctrl/c to get back to a prompt.

(1) Can someone tell me what is going on? I suspect that it is trying to match up the accent with another accent. But my output is from gcc and there is no control over the fact that it uses an accent and a single quote around a name.
(2) Can someone tell me how to do the grep so it does not give the ">" prompt but instead locates "xcvr" in my example?

View 4 Replies View Related

General :: GREP - Search Special Characters

Feb 10, 2010

I need to search for the following pattern with GREP in a text file:

So I tried already:

But none of those works...I think probably because GREP doens't like the special character > in the middle of the serach pattern.

At the end I just need to now if GREP found the pattern in the file or not, so it should give me a 0 or a 1 back, once I check the value of the variable "?" after using the grep command.

View 4 Replies View Related

General :: How To GREP String

Jul 29, 2010

Today, i checking my error log of Apache. I have look many IP brute scan URLo, i collect, export that to ip.txt and i need grep IP with connection >=8I don't know command to solve that. Example ip.txtQuote:

101 210.13.73.30
161 58.210.77.98
164 115.168.71.87

[code]....

View 2 Replies View Related

General :: Grep Not Recognizing All The Meta-characters When Used With -e Option.

Oct 13, 2010

I was trying to use the grep command with -e option to test some regular expressions with it but to surprise not all the meta characters were being recognized by the grep engine, how ever egrep works perfectly fine.

For example : The following egrp command works fine:

View 3 Replies View Related

General :: Using Sed And Grep With A Text String?

Apr 28, 2011

Q: Is there any way to use grep and sed with a string variable rather than with a file?

The problem: Im running through a LARGE (about 10,000 lines) xhtml file and need to replace every instance of lines beginning <p>~

The following code works but takes a long time mainlly because an in/out operation needs to be carried out on each line. If I could read from a string rather than a file it would take a much shorter time!

Code:
#!/bin/bash
count=$((0))
>tpf
echo "waiting....."

[Code].....

View 4 Replies View Related

General :: How To Search For String (Real Character) In Vim

Dec 1, 2010

How can I search "$" in vim, which is not the end of line but the real char '$'.

View 1 Replies View Related

General :: How To Get Number Of Occurrences Of String From Grep

Apr 29, 2010

How do I find a string in files in a directory. And these file names begin with letter a. I also want to get the number of occurrences of this string from the grep I run.
I tried this:
cat * | grep -c string but it searches all files. I just want to search files that begin with letter a

View 5 Replies View Related

General :: Specify More Than One String To Ignore (grep Command)?

Jul 28, 2010

I am using grep to filter out directories I am not interested in like this:svn stat | grep -v data/charts | grep -v lib/model | grep -v web/picsIt seems a bit "hacky". Is there a better way to specify more than one string to ignore, so that I dont have to chain multiple grep commands?

View 3 Replies View Related

General :: Search For A String In A Php File Using `grep`?

Jan 19, 2010

I am searching for Class declaration on a site with hundreds of PHP files, how can I do this in the current folder and subfolders using GREP?

I tested cding to the folder and then something like

grep -r 'class MyClass' *.php

View 5 Replies View Related

General :: Define A String Of Repeated Characters?

Feb 5, 2011

this seems like it should be a simple thing, but I can't find it. Is there a bash shell command that allows you to create a string of repeated characters? Like a string of 100 '*'?

View 6 Replies View Related

General :: Find A Substring In A String And Get The Next 3 Characters

Mar 5, 2010

for example

010100
this is the string

the substring is 010

i need to search for this substring and i also need to return the next 3 characters i.e 100.

i need to apply this for this string

01010000001001100000100010

View 8 Replies View Related

General :: Grep Fails In Shell Script When String Not Found / Why Is So?

May 3, 2011

I am having trouble using grep command. I want to search for each line in first file in second file and if they are present, write to file called successfile else to failfile. Below is the code

what is happening is, when the first failure occurs (when a line in first file is not present in second file), the script is killed.

Can anyone please tell me what I am doing wrong? code...

View 4 Replies View Related

General :: Using Sed To Replace String With Special Characters In XML File?

Apr 29, 2011

I am having difficulty getting sed to replace a string of text in an XML file, despite the fact that I have no trouble using grep to find that same string. Since the new string and old string to be replaced contain a lot of special characters, I thought it best to store them in variables as opposed to using a slew of backslashes:

OLD_STRING='<property name="webServiceHost">${jboss.bind.address}</property>'
NEW_STRING='<!--<property name="webServiceHost">${jboss.bind.address}</property>-->'

[Code]....

View 2 Replies View Related

General :: Search And Replace String Having Multiple Special Characters

Aug 26, 2009

Below is extract of my file:

What I need is to replace "--destination-path=" with "--destination-path=/home/dest"

i.e. desired output is ----destination-path=/home/dest

I could achieve it with below command

$cat outgoing-xfer|grep destination-path|perl -pi -e "s/destination-path=/destination-path=/home/dest/g"

But the problem is that in this case i just wanted to append "/home/dest" for which I could easily escape "/" with just two "", but I wonder if i have a long path like "/a/b/c/d/e/f/g/h/i/j" I will have to escape so many /. Is there any other way by which I can avoid escaping forward slash.

I tried following:

But receiving follo error

Bareword found where operator expected at -e line 1, near "s/destination-path=/'destination-path=/home"
syntax error at -e line 1, near "s/destination-path=/'destination-path=/home"
Bad name after dest' at -e line 1. tried with enclosing in double quotes as well but in vain

View 5 Replies View Related

General :: Bash - Using Find Or Grep To Locate Filenames With Accented Characters From A Different Encoding System (Windows)

Dec 6, 2010

I tried to tag late onto a question similar to mine on stackoverflow (Find Non-UTF8 Filenames on Linux File System) to elicit further replies, with no luck so far, so here goes again... I have the same problem as the OP in the link above and convmv is a great tool to fix one's own filesystem. My question is therefore academic, but I find it unsatisfactory (in fact I can't believe) that 'find' is not able to find non standard ascii characters.

Is there anyone out there that would know what combination of options to use to find filenames that contain non standard characters on what seems to be a unicode FS, in my case the characters seem to be 8bits extended ascii rather than unicode, the files come from a Windows machine (iso-8859-1) and I regularly need to fetch them. I'd love to see how find and/or grep can do the same as convmv.

[Code]....

View 2 Replies View Related

General :: Grep String From Logs Of Last 1 Hour On Files Of 2 Different Servers+calculate Count?

Sep 3, 2010

I am trying to grep a particular string from the files of 2 different servers without copying and calculate the total count of its occurence on both files. File structure is same on both servers and for reference as follows:

Code:

27-Aug-2010 10:04:30,601|919122874903|phtunes_app|1282243292627|NotifySmsReception|DMGenerateLogInterceptor - ExternalTransactionID:SDP-DM-26713018, TransactionStatus:Requested
27-Aug-2010

[code]....

View 6 Replies View Related

General :: Sed/awk/grep Search For Number String Of Variable Length In Text File?

Jan 19, 2010

I need to search a text file for a string of numbers which are different lengths, and always are between number=" and " like:

number="1234567890"
number="22390"

I need to grab those numbers and pipe each one to a line in a file. I've already tried something with awk and that didn't seem to work.

View 10 Replies View Related

General :: Use The Man / Info / Apropos Pages - Character Instructed The Shell To Interpret A Special Character As An Ordinary Character?

Mar 27, 2010

1.What character instructd the shell to interpret a special character as an ordinary character?

2.What directory contains some of the utilities available on the system in the form of binary files?

3. What command is used to search the location of a utility?

4. What command is used to instruct the editor to write the file and quit the editor?

5. What key quits the more utility and displays the shell prompt?

6. What command starts a child shell as the super user, taking on root's identity and environment?

7. Which wildcard characters can be used for searching all the files in the system that start with "A"?

8. The user name or login name of the super user is????

[Code]....

View 10 Replies View Related

Fedora :: Grep A File For Each '#' Character And Utf-8

Aug 15, 2010

I want to grep a a file for each '#' character that starts a line, the thing is the file is utf-8 and it starts with some some characters 'ef bb bf' is there a way to have grep to work with utf-8 files ?

[Code]....

View 2 Replies View Related

Programming :: Grep Until Certain Character Or Pattern Appears

Jun 25, 2010

I have the following command that greps "/etc/cron.allow" and displays the following 9 lines of $file grep -A 9 "/etc/cron.allow" $file On the other hand I would like to grep a file for a certain text display the next couple of lines and stop when i hit a specified word or blank or pattern.Basically I would like my grep to end when the shell hits a blank, certain key word or pattern specified in command.

View 7 Replies View Related

Ubuntu :: Regex In Grep - Match With Any Character Combination

Dec 10, 2010

regex in grep? I need to match ANYTHING in the following with any character combination (something like * in findstr in C): grep "Delivery of nonspam" /var/log/mail.log | grep "to [URL]"

View 1 Replies View Related

CentOS 5 :: Character Set On Installs - Danish Characters - UTF-8

Feb 10, 2010

I am having a problem editing / decoding files and characters in UFT-8 on my CentOS installs. I have a single FreeBSD server where the problem does not exist. Basically, what happens is that Danish special characters, as well as other non-ASCII characters, come out garbled when processed on the system. As an example, if I open a vim editor and type characters like � it comes out as ø

If I try using nano, the characters come out as Relatedly, if I import UTF-8 encoded files from other sources, they also appear broken when edited locally. I have tried updating the system language using system-config-language. Also, I have no desktop environment installed, I access my servers only through the command line. Here's some information that may or may not be relevant, (I have googled the problem a while and have come up empty except for references to some of these things that are already set):

[Code]....

View 6 Replies View Related

Programming :: Get Value In Character String?

Oct 23, 2010

i am compiling the following program in linux. it's in c language. after the compilation with gcc when i run the executable file. it asks for input. but when i enter a name. i prints "Segmentation fault" and then terminate the program. can you please help me.

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>

[code]....

View 1 Replies View Related

Programming :: Remove Characters From Grep Output?

Apr 14, 2010

How can I remove characters from grep output using sed? code...

View 9 Replies View Related

Programming :: Grep Not Getting Whole String?

Aug 23, 2010

I am trying to monitor how long an ldap search takes and maybe notify or something that a search takes longer than say 10 seconds.

Code:
tail -n 1000 /var/log/ldap.log
for SRCH in $( cat monitorldap.log |grep 'SRCH'); do
echo search string is
echo $SRCH

[Code]....

ok, so to start off with it doesn't appear to get the whole line, just a piece "Aug". How can I get the whole line into a variable so I can then cut it up into the pieces I need?

View 4 Replies View Related

Programming :: Replace The Last Character String?

Jan 19, 2011

how to replace last character string. For example

$>export T1=abcde
$>export T2=xyz

how to get result abcdxyz?

View 10 Replies View Related

Programming :: Grep A String With Space?

Feb 9, 2010

I am using Sun 5.9.

I am putting the value "Feb 10" in variable 'c' here.

Code:
-bash-3.00$ c=`date | awk '{print $2 " " $3}'`
-bash-3.00$ echo $c
Feb 10

But when I am grep-ing value of 'c', I am getting this error.

Code:
-bash-3.00$ ls -lrth | grep $c
grep: can't open 10

This is because there is a space between "Feb" and "10".

View 5 Replies View Related

Software :: What Is The Existing Period Of Character String In C++/c

May 18, 2010

Like the following c++ program, I define a pointer of char type in the class named "test". In the function init1(), str="hello1" , what is the existing period of "hello1". Whether the string "hello1" will be invalid if the function init1() exits ? then "str" point to the invalid field in memory. When will "hello1" and "hello2" be released by OS ?

Where is "hello1" stored in memory?

Code:

When will "hello everyone" be released?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved