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
ADVERTISEMENT
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
May 27, 2010
I just upgraded from 9.04 to 10.04 and so far I have those problems:
1. Before, everything in my system was in English. Now, half is in English, half in another language (PCManFM, some menus etc). I tried setting up Language Support but it changes nothing.
2. Cursor themes work only when hovering the mouse over "X" buttons in the right top corner of the window. As soon as I move the mouse somewhere else, it goes back to default cursor theme, even though I tried selecting 5 different themes - same result.
4. Hibernation don't work anymore. s2disk saves image to disk and then it resumes it but computer stops on text message along the lines of "Resume completed successfully".
5. Changing volume with keyboard shotcuts no longer works.
6. Smplayer does not display picture anymore when playing movies. The view is just empty. I can only hear the soundtrack. It is using XV filter.
7. PCmanFM that used to worked flawlessly, now after going into 1 or 2 subdirectories stops reacting to clicks on file/folder list. Need to open new instance to be able to do anything and this again would become unusable after visiting 1-2 folders.
View 4 Replies
View Related
Jun 22, 2011
I'm not sure if this is the right place for this. I'm not sure which veraion of linux I have but it was the latest veraon bfor the recent update. I accidentally hit alt ctrl f11 and my comp went inyo the grub menu. I've tried startx and it does nothing. About half the commands I enter do nothing and the other half r not found or are incorrect. The only vommand thw actualley work is reboot. I searched for this and read a grub guide but it did no good.
View 4 Replies
View Related
Mar 20, 2011
I have a HP DV9000 laptop. The second hard drive bay doesn't support SATA II devices. I was cloning the original hard drive to the newer SATA II hard drive I purchased two swap them because bay 1 does support SATA II devices. I decided to use
Code:
dd if=/dev/sda of=/dev/sdb
to get the job done. I double/triple checked my command with fdisk -l, but my dyslexia got the better of me. I should have ran
Code:
dd if=/dev/sdb of=/dev/sda
....
I stopped the command about 1/2 hour in, it is a 160GB hdd. I tried using foremost to recover all of the files that hadn't been written over yet, but it can't recover Quicken filetypes. The ONLY thing I need off of this drive is the Quicken database. TL;DR I need to recover a quicken database file off my corrupted partition. What program can I use?
View 1 Replies
View Related
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
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
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
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
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
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
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
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
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
Jul 13, 2011
I am not sure why this does not work..
tshark |grep 'string'
Gives me what I want but
tshark |grep 'string' >/tmp/outputfile
Gives me an empty file.
View 3 Replies
View Related
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
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
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
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
Feb 16, 2011
I have following contents
I want to grep "#2" and want the output as
How to using shell script?
View 6 Replies
View Related
Mar 4, 2010
I wanted to grep the line in a file starts with -1.000000e+00.
Tried grep "-1.000000e+00" *, got error "grep: invalid option --".
Neither of the following works:
grep "-1.000000e00" *
grep "1.000000e00" *
How do I grep a negative number with scientific notation?
View 3 Replies
View Related
Mar 16, 2010
I ran into a bit of trouble making a bash script. (Desktop is a directory, and I try to get it's modification date)
Code:
lamp:~# cmd='ls -l Desktop | grep -o "....-..-.. ..:.."'
lamp:~# $cmd
ls: cannot access |: No such file or directory
ls: cannot access grep: No such file or directory
[code]....
When I type in the command directly, without using an inbetween variable, it works fine.
View 3 Replies
View Related
Sep 25, 2010
I would like to write a newline delimeted rules file using PCREs for use with the grep command. Grep has the option -f to obtain the search pattern from a file, and option -P to search using PCREs. However, these two options do not work together. The -f option only seems to work with fixed string rules.A friend previously helped me get around this limitation somehow, but I can't remember how he did it. I also would like the ability to add comments at the end of each rule in the file.
View 11 Replies
View Related
Feb 1, 2010
I have a number of files:FooBlahhFooI only want to be able to grep for names in a file that contain Foo and not BlahhFoo. However I am not able to pull only those files away. How can this bee done. My grep/zgrep knowledge only goes this far at this point. I'm still learning but I'm stuck on how to make my arguments more precise zgrep 'Foo' SomeFileIMade.gz > /home/user/FOOFILE
View 4 Replies
View Related
Jul 16, 2011
I am using File::Find to go through a very large tree. I am looking for all xml files and open only those that contain a tag <Updated>. I then want to capture the contents of two tags <Old> and <New>.
My problem is, after I open the file and do the first grep for <Updated> (which does work), I am unable to grep again unless I close the file and open it.
I did something like this:
Quote:
find(&check, $dir);
sub check {
if ($_ =~ /.xml/){
open(FILE,"$_");
if (grep{/Updated/} <FILE>){ # <-- works
[Code]....
View 6 Replies
View Related
Jun 2, 2011
I am trying to use grep to only tell me files that include both words matching in a pattern file. However when i specify:
grep -f <pattern file> <file>
It pulls out anything that matches one or the other.
Not both.
how to get it to match AND not OR.
View 9 Replies
View Related
Jun 17, 2009
I have a list of words that I want to grep in many files to see which ones have it and which ones dont. in the text file I have all the words listed line by line, ex: list.txt:
check
try this
word1
word2
open space
list ..
I want to grep each line one by one. like I want it to
grep "check" *.log
grep "try this" *.log
grep "word1" *.log .. etc how can I do this?
and maybe write the output to a file.
View 5 Replies
View Related
Sep 24, 2010
I am attempting to grep the contents of a key file I have SCP'd to a remote server. I am able to cat it:
Code:
[bluethundr@LBSD2:~]$:ssh root@sum1 cat /root/id_rsa.pub
root@lcent01.summitnjhome.com's password:
[code]...
View 5 Replies
View Related
Apr 7, 2009
Is it possible to use grep to search for a sequence of bytes? For instance say I was looking for the following byte sequence in a file:
64 03 40 30 ; add eax, fs:[eax+30h]
Is this possible to do using grep?
View 5 Replies
View Related
Apr 2, 2010
What I'm trying to do is grep [mysqld] from inside my.cnf and then add lines inside the file should they not be there. how do i do that?
View 3 Replies
View Related