General :: Grep - A-Z - Returns Unmatched Lines ?
Feb 21, 2011
Does anyone know why something like:
echo lowercase | grep [A-Z]
Would still return the lowercase line even tho there is no match?
Using --color will show there is no match but the line is still returned.
I am still new but from what i've learned this should not work like that. ubuntu 10.10
View 13 Replies
ADVERTISEMENT
Aug 7, 2010
I know how to use grep to output a line that matches a string. But what if I also want to output one line above every line containing a matching string, how do I do that?
View 1 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 6, 2011
I have a large file in which each line has three or more blank-delimited words. I'd like to code a grep to keep only those lines which have the letter M in the last word. the M (if present) will be the first character in the last word.
View 14 Replies
View Related
Apr 11, 2011
I have a file that goes like this:
I need to grep the lines between pattern 1 and pattern 2 and not the lines following pattern 2. Cannot use grep -A(num), as there are varying number of lines following pattern 1. Also, used awk one-liners, but results are erroneous.
View 14 Replies
View Related
Feb 3, 2011
I have done this before but i cant really recall now
I have a text file and i want to grep the word "interface" and 10 lines following it. I think there was some switch like grep -A or something ?
View 2 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
Mar 22, 2010
I have some big files of logs that contain errors printed by an app. They are most of the time relevant, however most of them are similar. So i figured i could check what happened between a time interval with a find.
Im using this one
Code:
And I get an output similar to this one.
Code:
Is there a way to condensate the output lines to get only one or two, indicating the start and last occurrence of a block? Or I need to create a program to do so?
Because right now I get thousands of similar lines, but when I'm scrolling through them i sometimes miss relevant information that i would've otherwise noted if it wasn't all that spammy.
View 10 Replies
View Related
Apr 8, 2011
So For example I run this command:
Code:
But want to gerp / cut it in such a way that it only displays
Code:
Now the thing is that these 3 lines are not static.. there can be N number of lines there.. the only thing is that I want the command / output NOT to display the first line but the rest of the n lines ..
View 9 Replies
View Related
Sep 1, 2009
I have a dataset (see example below) that I would like to go through and copy all lines containing a certain string ("LGIG") plus the line immediately following that line to a new file. I have no problem grepping lines containing the string LGIG but I'm lost how to translate that to line number and shift up one line number for each instance of that string.
Example input file:
[code].....
View 5 Replies
View Related
Dec 9, 2010
I need to grep a pattern which can be present in one line or could be split in 2 lines.Normal grep wont work in this case. Can anyone please help on this?There are 100's of files in which i need to search for this pattern so time is also a constrain.
View 5 Replies
View Related
Jun 9, 2009
I would like to know how I can get the ouput from the following dmidecode command in example 1 to look like example 2 without having to grep -v all the unwanted lines.Is there a way in awk or sed?Example 1
Code:
Processor Information
Socket Designation: Socket 1 CPU 1
[code]...
View 7 Replies
View Related
Sep 17, 2010
I have such a file(test.txt) as below:
[code]...
I want to use grep to fetch the lines contain 'AB_001'.
[code]...
get the first 2 lines, not the 'AB_0011/10/105'.
View 2 Replies
View Related
Feb 25, 2010
To start, I'm writing a script to check a file's date via FTP. Here's the portion that I'm having problems with:
Code:
function checkRemote
{
[code]...
View 7 Replies
View Related
Jan 26, 2010
I've come across an unusual requirement for a service in my Ubuntu system.Simply put, I need to find a way to search for all instances of a term in a file, delete lines containing containing that term, and delete four lines below each instance of that term. ither that, or copy the entirety of a file to a new file and skip over all lines containing the term plus four below it.This sounds kinda weird, I know. Without going too far into detail, I either have to change the logfile format for a server I'm running which is a huge pain in the butt, or I can just run a script to edit an HTML report generated from said logs. (Said report is really just for managers to peruse, and I like my log format, so I'm pursuing option 2.)
View 4 Replies
View Related
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
Jan 13, 2010
i assumed :i insert mode would allow to simply back space, no appearently not? it seems none of the websites anywhere on earth mention how to delete a carriage return in vi.
View 3 Replies
View Related
Apr 22, 2011
I have been experiencing a problem where the screen loads and after initial first few lines breaks up into multiple repetitions of lines. Reloading helps but has to be repeated when pageing down. Mail is no problem; it is supplied by my network provider. OS is openSUSE 11.2 which I update when advised. Below is a sample from the error console:
[Code]...
View 1 Replies
View Related
May 31, 2011
I've just installed Kubuntu 11.04, switched on wobbly windows effect. It runs very smooth on my Nvidia GeForce 7600 GS with dual screen twinview turned on. However, I get these lines when I drag/move the window upwards - see screenshot:
View 6 Replies
View Related
Aug 20, 2009
I use the time command to measure the wall-clock time of a GPU implementation of an algorithm. When I time the CPU execution of the algorithm time returns a negligible sys time. However, when I time the GPU execution time returns a sys time that is around 20-30% of the total time. If that time was comparable with the negligible sys time of the CPU I would achieve a speedup of a few times higher.
I suspect that the increased sys time is because of the GPU usage, which, I assume, takes some time for the OS because of the drivers etc. I am not sure though, and it is important to figure this out because it will improve my results a lot if I can ignore the sys time and use just the user time for speedup calculations. Also, is there a way to see, in detail, what is the sys running and takes so much time. I am thinking that I might be able to see if it is the driver indeed that causes this delay.
View 6 Replies
View Related
Nov 24, 2010
I have this issue: "nc -v <ip-address> 22" works fine, but "nc -v <fqdn> 22" fails with error message "nc: getaddrinfo: Name or service not known". However, "host <fqdn>" works fine, so name resolution works. So I have a working name resolution, but nc (netcat) doesn't seems to be using it or something. Same kind of issue with "ping <fqdn>". Does anyone know how come name resolution works, but utilities such as nc and ping doesn't?
View 2 Replies
View Related
Nov 24, 2009
How do you remove parts of strings using python? Such as, if I have something like:
Code:
erme1 sdifskenklsd
erme2 sdfjksliel
[code]....
View 3 Replies
View Related
Oct 26, 2009
I have this massive table file with some data in it and I want to replace some lines that are wrong with the correct ones that are in another table file of the same format. The wrong lines are not all together in a block but randomly distributed so I need to make a loop checking if the line is in the other file and if it is, replace it. I want to try and do it with sed or awk but I don't really know how to....
View 12 Replies
View Related
Jan 19, 2010
I am trying to install wxpython from source package when ran ./configure command it came up with a strange message which says
Code:
Code:
View 8 Replies
View Related
Mar 21, 2011
For some reason the script below works fine when I run it directly but when I run is using source, I get a not found error?
With source: (line 11 is where the 'test' statement is)
Quote:
gtonder@sydlnx03:~> source set_aliases.sh -v 11:31AM
1
set_aliases.sh
[Code].....
View 6 Replies
View Related
Mar 5, 2010
First time here at LQ, so if the post is in the wrong place, this is a bit programming related. I've been trying to find the maximum resident memory of a process in a memory constraint situation.
Instead of using top, or ps, which gives me real-time snapshot at the memory usage of a process, is there a way to determine the maximum resident memory used by a process? /usr/bin/time seem to provide this functionality within the format string
[Code]...
The minor page-fault is suspicious, does that mean memory is being used.. but not recorded? if so, how can I know how much memory is being mapped?
View 3 Replies
View Related
Sep 26, 2010
I want to change the Boot sequence in Ubuntu 10.04.
In the past I have used
Quote:
But with 10.04 this returns a blank screen. I assume something has changed.
View 3 Replies
View Related
Mar 20, 2011
When I type the command
Code:
startvnc
I get the following error
[code]....
View 8 Replies
View Related
Apr 4, 2011
create a tar file from a list? My script returns the error: AttributeError: 'list' object has no attribute 'startswith' I want to create a compressed tar file containing the directory /usr/lib and the files in the list assigned to variable b.
code:
import tarfile
tar = tarfile.open("backup.gz", "w:gz")
[code]....
View 3 Replies
View Related
Aug 13, 2009
I want to use ssh to execute a command and to wait endlessly to log everything (in file) that comes as a stream of the connected server. But unfortunately, in the manual its written "If command is specified, it is executed on the remote host instead of a login shell"
So what happens is that when I specify my command:
ssh user@server "my_command"
It executed the command and the flow of execution returns to bash shell. So basically my session ends right after the command is executed. This happens only in case I specify command in the command line. If I login into ssh manually and then type "my_command", then the session doesn't end. I want the ssh not to exit, because after "my_command" executes, I want to capture everything in the session.
View 3 Replies
View Related