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


ADVERTISEMENT

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

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

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

Programming :: Input File - Grep Within Grep

Nov 22, 2010

I need to kind of grep within grep. My input file would be something like:

[Code]....

and I need to find the first occurrence of hello before MY PATTERN (hello 9008 in this case), so the output should be:

[Code]....

View 4 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

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 View Related

Red Hat / Fedora :: Change File Names To Remove Invalid Character

Apr 1, 2009

I am trying to copy a large number of files from a Linux server to a Windows file share. Unfortunately, all of the files and folders I have to copy have 10 numbers followed by 2 colons "::" in the name (example: 1234567890::WordDoc.doc) which of course is invalid in windows naming conventions. So now I'm trying to come up with a way to change the file and folder names on the fly to replace the colons with a dash "-" or space " ". I'm even willing delete the frist 12 characters in necessary. I have tried cp, mv, tr, and several -bash scripts but get no positive results.

View 4 Replies View Related

Programming :: Variable String File Base - Output File Doest Not Exclude The Values In Grep -av

May 1, 2011

My script.

This is may script:

Code:

Problem: Output file doest not exclude the values in grep -av

View 3 Replies View Related

General :: Grep The Contents Of A File With Another File?

Sep 25, 2010

someone once told me that use can pass a file to grep and use that to search the contents of another file. if that is the case I'm not entirely sure why the following isn't working for me.

Code:

[root@LCENT01:~]#grep -i id_rsa.pub .ssh/authorized_keys
[root@LCENT01:~]#cat id_rsa.pub >> .ssh/authorized_keys
[root@LCENT01:~]#grep -i id_rsa.pub .ssh/authorized_keys

View 3 Replies View Related

General :: Change File Character Set?

Aug 9, 2010

I would like to know how I can change a file so it has the same character encoding as files saved as comma separated csv files from Microsoft Excel.

I have tried using iconv to do this. code...

View 5 Replies View Related

General :: Use Grep, Cut, Or Awk To Get An IP From A File?

Feb 3, 2010

I have a file which contains a line like this:SERVER=10.205.110.19 How can I cut out the IP and assign it to a variable?

View 4 Replies View Related

Programming :: HUGE Files - Compare A List Of Patterns From One File And Grep Them Against Another File And Print Out Only The Unique Patterns?

Aug 13, 2010

I am trying to compare a list of patterns from one file and grep them against another file and print out only the unique patterns. Unfortunately these files are so large that they have yet to run to completion. Here's the command that I used:

Code: grep -L -f file_one.txt file_two.txt > output.output Here's some example data:

Code:
>FQ4HLCS01BMR4N
>FQ4HLCS01BZNV6
>FQ4HLCS01B40PB
>FQ4HLCS01BT43K
>FQ4HLCS01CB736
>FQ4HLCS01BU3UM
>FQ4HLCS01BBIFQ

how to increase efficiency or use another command?

View 14 Replies View Related

General :: Remove Abnormal Character DEL From A File Name?

Jul 22, 2011

I have got certain files which somehow contain abnormal character "Del" "0x7f" or 177 which represents Del. And this is causing SVN to reject these files and abruptly end the process. I need to remove those characters from the file names but am not able to. find or grep do not search the files. This is how the file looks like with ls or find code...

View 3 Replies View Related

Programming :: C++ Character Search In Text File?

Jun 23, 2011

Im trying to read a file in c++ and search for particular character for example if this is a list that I have:

Alice
Bob
David

[code]....

if the input is D, it should give David, if its B, gives bob. so in this case, meaning it reads the first character of every line. but if possible I want to make this dynamic so the user can specify which character position he is looking for, so in case he is looking for R as character index 3 in all lines, it should give Charlie. but the problem is, it does now recognize , besides, I do not know how to specify the character position in each line.

here is my code

Code:

#include <iostream>
#include <fstream>
#include <cstring>

[code]....

View 1 Replies View Related

Programming :: Check .xml File And Which Character Is Malformed In 'utf-8'?

Jun 15, 2011

I need some software that will check .xml file and tell me which character is malformed in 'utf-8'. I am using perl for some parsing.

View 2 Replies View Related

Programming :: Sed To Change Character In Text File Only Once?

Sep 7, 2009

I have a script that looks like:

Code:

cat servers.txt
trivia:P:N
trivia:D:N
tucana:P:Y

[code]....

I want to be able to find the lines that matches my input and change the N to a Y, but only for the lines that matches the name and not any other N's My problem is the line does not always contain a P as it can be a D as well so my matching did not work. If my script issues the name $1=triva the lines will change to:

Code:

trivia:P:Y
trivia:D:Y

I have the following code so far but as you can see it does not change the D's

Code:

sed -i 's/trivia:P:Y/trivia:P:N/g' servers.txt

*** UPDATE ***

should I be using a method as follows? I am still stuck on the changing all instances though.

Code:

$1=server
sed -i 's/$server1:P:Y/$server:P:N/g' server.txt
sed -i 's/$server1:D:Y/$server:D:N/g' server.txt

View 7 Replies View Related

General :: Grep Or Sed Or Awk For File Manipulation?

Dec 7, 2010

Let me *try* and explain what I'm trying to do, and keep in mind aside from a little command line stuff I'm a beginner to any of what I'm asking about.

I have a directory structure something like this:

Code:

/usr/local/chatlogs/
webserver1/
1.chatlog
2.chatlog

[Code]....

So that whatever was captured in the () in the first part of the statement would be used in the 1 in the back part of the statement for every n.chatlog that might be in any of the /webserver directories at that time.

View 2 Replies View Related

Ubuntu :: Grep Can't Search Pdf File?

Jun 2, 2010

i want to search some key words in some pdf files grep myword ~/test.pdf that command can't work! grep command can't search pdf file??

View 1 Replies View Related

Ubuntu :: 'grep' Exactly Half Of A File?

Jun 29, 2010

so i have a data file of a couple thousand lines. for example, my file will look like this (condensed of course):

Code:
something something 100 something 1 2 3
something something 101 something 4 5 6

[code]....

View 4 Replies View Related

General :: Grep 2 Items In A File?

Dec 31, 2010

I have collection my routers configuration through rancid. Now i want to do the following,

Display all the files that contain the following words

C1841 AND HWIC-4ESW

I want to display all the files that contains both these words.

View 14 Replies View Related

Programming :: Grep The Patterns From The File?

Aug 10, 2010

I am interested in using the grep method in the shell of my CentOS machine to obtain patterns from a file and use them to search through another file and highlight the patterns found. For example:

pattern file:

one
two
three

test file:

AAAAAAAAAAAAAAAAAAAAAoneAAAAAAAAAAAAAAAAthreeAAAAAAAAAAAA

View 8 Replies View Related

General :: Tool To Convert A File Of HEX To ASCII Character Set?

Feb 10, 2011

Is there a known tool to convert a file consisting of 2 byte Hex into ascii?

Note: - Maintain file offset listing in bytes code...

View 3 Replies View Related

General :: How To Ignore Rows With Specific Character In Csv File?

Mar 11, 2010

I have a csv file that has around 3 million rows. I want to process this file so that it creates a new file that contains only the rows that have 2 characters or less in the first column column.At the moment i am using SQL Loader but its taking too long so im wondering whether this would be easier if done in Unix?

View 8 Replies View Related

Software :: Deleting All Instances Of A Certain Character From A Text File?

Feb 18, 2010

In my command prompt I did:

Code:

sed 's/://' mytextfile > newtextfile

But it only deleted the first instance of : in each line when some lines have multiple : appearing in each one. How can I delete all the : from the entire file?

View 6 Replies View Related

General :: Read File And Pipe To Grep

May 26, 2011

I'm storing a list of strings in a file and would like to read the file and pipe each line returned to grep which in turn searches a directory for files containing the string.However this is not returning any output.

View 2 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

Programming :: Grep A Particular Data From A File Without Using The Command

May 3, 2010

I want to know that is there any method to grep a particular data from a file without using the "cat --- | grep ' ' " command....I need to use a system call for this functionality.

View 1 Replies View Related

Programming :: Find A String In A File Without Using Grep?

Oct 27, 2010

I want to write some code to search for a specific string in a text file, but without using grep command.

View 5 Replies View Related







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