General :: Backwards Double Grep?
Mar 9, 2011
I have a file like this:
Code:
I need to search it backwards for "notable line" strings AND the first numeric string preceding that line. I've discovered that it's easy to search backwards by tac file | grep pattern, but how to tell grep to continue searching from where the pattern was found? In short, I want to make the output of the example above into this:
Code:
Or I must use another tool, like awk or sed? If so, how do I do so?
View 3 Replies
ADVERTISEMENT
Dec 27, 2010
I want to scroll back 10000+ lines in text mode linux terminal. As there is an unlimit option in gnome-terminal, so I guess if this is also possible in text mode?
View 2 Replies
View Related
Nov 24, 2010
Let me begin by saying that I'm a "casual user" of my computer (I'm a retiree who uses her 'machine' for email, looking up mostly useless info, & pretending to be a writer). However, migraines from beating my head on the keyboard in frustration over Windows eccentricities led me straight to Linux. Linux blows windows out of the water, IMO.
Except for Media Players. I have tried every one in Ubuntu's software catalog. Rhythmbox is the only one that works, & it doesn't work correctly. I use my computer as my primary music source, & have saved nearly 200 albums/CDs to it. I transferred my collection to a memory stick, then tried to transfer it to Ubuntu. Rhythmbox 'accepted' most but not all albums, but none of the downloaded music, & lists the songs in each album backwards. When I open an album, sometimes Rhythmbox plays them backwards, sometimes (rarely) 'frontwards', but usually, jumps around, plays a few of the numbers, then stops. Occasionally, it goes through the collection, playing one song from each collection.
I was able to transfer the entire collection to 'Listen' media player, but it doesn't actually play anything, & I never even got that far with any other player. I have a two year-old HP Compaq Presario desktop w/ 500GB, (300 to Ubuntu & the rest to The Dreaded Windows for some stuff I can't run on Linux). I began with running Ubuntu 10.04 on 'wubi', then installed it from a CD I burned from the Ubuntu site. Someone suggested I had screwed something up during downloading, so I got 10.04 on a CD (w/ "Ubuntu for Non-Geeks"), but had the same media player problems. Last month I upgraded to 10.10, but still have the same problems.
View 9 Replies
View Related
Jun 19, 2010
My laptop's been locking up in Linux (Ubuntu, Backtrack, Puppy) periodically for a while now. When it locked up, it was always immune to the magic of SysRq, which I thought might indicate a hardware problem. It became so bad that I had to stop using the laptop.
Today, when I turned it on and tried to boot into Fedora 12, I got the following error (just once, it just locked up at various points during the splash screen after this once):
double fault: 0000 [#1] SMP
last sysfs file:
CPU 0
odules linked in:
Pid: 1, co m: swapper Not ta nted 2.6.32.11-99.fc 2.x86_64 #VGN-T 250N
RIP: 0010:[<ff
All the seemingly missing letters were really missing, not my typos.
As you can see, kernel version is 2.6.32.11-99.fc12.x86_64 and my laptop is a Sony Vaio TZ 250N (Core 2 Duo ULV 1.2GHZ). Note that with the other remaining kernels from the updates, nothing ever happened other than the locking up. The core temperatures hover pretty high, about 55-60C peak but this is still below the critical temp. Memtest came up clean when the problem first started happening.
View 3 Replies
View Related
Oct 25, 2010
I'm trying to use sed to search and replace backwards. The problem is that I have a shell script that is required to put commas into big numbers. For example
9999999 as 9,999,999
I've tried a few things, but none seem to work:
Code:
$ echo 9999999 | sed -e 's/([0-9]{3})/,1/g'
,999,9999
$ echo 9999999 | sed -e 's/([0-9]{3})$/1,/g' -e 's/([0-9]{3})/1,/g'
999,999,9,
$ echo 9999999 | sed -e 's/([0-9]{3})$/1,/g' -e 's/([0-9]{3})/,1/g'
[ode]....
It would be much easier if I could search backwards! For example Bash parameter substitution style:
Code:
$ echo 9999999 | sed -e 's%([0-9]{3})%,1%g'
View 14 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
Sep 1, 2009
I'm running CentOS 5.3 on a laptop and there are numerous warnings in the dmesg output that look like:
Warning Timer ISR/0: Time went backwards: delta=-252671169 delta_cpu=-248671169 shadow=6729603658291 off=235680520 processed=6730092000000 cpu_processed=6730088000000 0: 6730088000000
View 3 Replies
View Related
Jun 2, 2010
I am running a LAMP system with CentOS 5.4.The clock just automatically shifted backwards by 19 hours and 30 minutes crippling some of my reports and probably damaging something else along the way.The router supplying IP to this server is a DD-WRT and shows proper time.By the way what does that mean? time drifted by that 33.667 ms?
View 8 Replies
View Related
May 30, 2011
Just installed F15 using preupgrade (from F14) and now, every time I reboot, time jumps backwards 4 hours. If I reboot twice in a row without correcting the time, time will be off by 8 hours. Time zone is set correctly (Eastern Time). "Synchronize date and time over the network" is unchecked.
Since the difference between GMT and Eastern time is 4 hours, there appears to be some confusion over that but I can't find anything in the "Date & Time" app relative to that to try to play with to see if I can correct this. II do remember a similar issue many releases ago but I can't remember how it was dealt with.
Any ideas on how to diagnose and fix this?
View 8 Replies
View Related
Apr 9, 2010
when watching a movie in browser (ff/chrome) or using mplayer to replace flash on ..... for instance, i cannot skip around the video i'm watching...
- is there a way to be able to skip forward/backwards with mplayer?
- is there a way to replace mplayer with another program that will allow me to skip?
View 4 Replies
View Related
Jan 17, 2011
Dovecot is setup to run on each startup but each time I restart my system, I find that it is not running(killed), when I check my logs it says time moved backwards for x seconds. Essentially, I'm having this problem, [url] what is the solution in ubuntu so that dovecot would not be killed on startup? currently I have to put /etc/init.d/dovecot restart into rc.local to restart it again...
View 1 Replies
View Related
Jul 13, 2011
For shifting forward, we select the required part and press tab the number of times we want to move forward.
What's to be done for shifting the same backwards other than pressing Ctrl-Z?
View 3 Replies
View Related
Jun 28, 2011
I need a Linux O.S. to double-boot with Win7 (already installed). It should be user-friendly, have a tv player (Myth TV?) already installed and as-far-as-possable already configured for my tv stick..Avermedia. Emphasis should be on multimedia..with good video decode/encode possabilities. I`m considering either Mythbuntu or Linux Mint.
View 3 Replies
View Related
May 25, 2011
when I login through SSH, I get a double welcome message:
login as: laurent
laurent@192.168.1.2's password:
Linux server 2.6.32-31-generic-pae #61-Ubuntu SMP Fri Apr 8 20:00:13 UTC 2011 i6
[code]...
View 1 Replies
View Related
Feb 27, 2010
I am currently using Windows Vista and Linux Ubuntu (I'm not 100% sure which version).However, whenever I start up my PC, I get greeted to the HP BIOS screen, and then after that, I get the Windows Bootloader.Now, this is where things get interesting:If, on the Windows Bootloader I select Microsoft Windows Vista, it loads Vista.If I select Ubuntu on the Windows Bootloader, I get treated to a second bootloader (I assume the Ubuntu Bootloader).I'm wanting to remove one of the bootloaders (keeping Vista as my primary OS, but still having access to Ubuntu in the bootloader). As a result of this, which bootloader should I remove, and how would I go about removing such bootloader?
View 2 Replies
View Related
Feb 20, 2010
I've been getting a weird display on my Mac iBook G3 power PC W/ Dual USB.This has happened on Kunbuntu 9.04 PPC and Ubuntu 9.10 PPC. Both are standardnstalled fully patched.Attached is a picture of the display as you can see the right 2 inches is black and 2 inches from the bottom is where the display start over again.
View 2 Replies
View Related
Jun 10, 2010
I am new to linux and bash programming. I wrote a simple hello world program.
the code:
#!/bin/bash
echo hello world
but I can not run it by clicking on it.
The only way I ran it is using the terminal even after I check the is it executable box.
Do I need to add any commands to make it execute by just clicking on it?
View 11 Replies
View Related
Jun 6, 2010
In bash I need to use some equivalent of double quotes inside double quotes (or the other way around.)I need to run the following statement to get the output of foo and store it in a variable while passing foo the $file which probably contains spaces.
Code:
variable=$(foo "$file")
The problem is that foo might return an empty string and if it does I need to catch it
[code]...
View 6 Replies
View Related
Jan 29, 2011
I am trying to synchronize the content of the directory my_dir/ from /home to /backup. This directory contains a file which name has a double quote in it, such as to"to. Here is my rsync command:
rsync -Cazh /home/my_dir/ /backup/my_dir/
And I get the following message:
rsync: mkstemp "/backup/my_dir/.to"to.d93PZr" failed: Invalid argument (22)
For info, rsync works well when the synchronized filenames contain single quote, parenthesis and space. Thus, why is it bugging with a double quote?
View 3 Replies
View Related
Dec 12, 2010
I know it is pretty trivial but anyway...I have php file that I am trying to read it looks like this
...
add_item_tabulky("Klaun-PF 2011","klaun_pf2011.jpg","","","");
add_item_tabulky("Pras�tko-�ťastn�
[code]...
View 3 Replies
View Related
Jan 5, 2011
Possible Duplicate: Basic ssh tunneling through generic linux ssh server/client. I'm have trouble transfering files again from my work PC, which is a linux machine to my home windows PC.My work has changed it so I now need to SSH twice before I can access my PC.So I need to:
ssh username@server.name
password: xxxxx
I then need to do it again.
ssh computer_name
password: xxxxx
I've tried accessing directly via my computers IP but to of no avail. Is there a way I can use pscp or file zilla to ssh twice so I can transfer files?
View 2 Replies
View Related
May 19, 2010
I tried to move a file from my desktop to another folder; moving it was not allowed, for some reason. Neither was opening it and saving a new copy in the target folder. Would that be because the filename contains double (") quotation marks? Are they not allowed? The filename is Edit of Bob's "Lady Liberty" Article.doc. [Filename not enclosed in quotation marks here, to avoid confusion.]I just changed the double quotation marks to single quotation marks; that solved everything.
View 2 Replies
View Related
May 5, 2011
i have a transcend's 4gb pen-drvie.when i plug it in usb drive it blinks n i get an icon in 'my computer',but when i double click over it,it doesnt open.my other usb devices like mouse are working fine. this is 'lsusb' output without pern-drive inserted.
[code]...
you will notice that device 15 is the pen drive. i dont know how to access my pen drive.
View 9 Replies
View Related
Jan 25, 2010
I just downloaded a .exe file. I cannot get it to install after I double click on it. What should I do to make it work?
View 6 Replies
View Related
Jan 7, 2011
I use PCLinuxOS. I want to install mklivecd. I can't double-click mklivecd.rpm to install its dependencies. rpm -ivh mklivecd.rpm shows me a list of dependencies that have to be installed manually. What now?
View 2 Replies
View Related
Jul 19, 2010
I am arthritic and I have considerable difficulty with a double click. I also have difficulty when using a mouse of moving the mouse as I select something (click the button) from whatever window I am working with and thereby selecting the wrong thing. To compensate for this difficulty, I use a Logitech trackball and program the center button to perform a double click with one stroke. I am currently struggling with Linux Mint 9 in my search for a Windows alternative. Is there any way to program my center button (scroll wheel) to perform a double click in this or any other Linux version? Alternatively, is there any way to program a keyboard key to perform a double mouse click with a single stroke? I do not want any multiple key combinations for this operation, I want something that works with a single click of one button.
View 4 Replies
View Related
Jan 16, 2011
I have just installed ubuntu 10.10 on a separate partition on my hardrive and when the screen starts up its in double vision and shaky. Have you had any such probs with ur installs. If so whats the cure. It clears after awhile and never had any probs with the old ubuntu OS.
View 2 Replies
View Related
Feb 27, 2010
I could run the script from terminal. My script invokes some installation and works fine.But my wish is that end-user should double click the sh script and it should run.But how? I got few links - but none was of was quite helpful
View 6 Replies
View Related
Aug 25, 2010
I saw an article use the following cat command to create a new text file:$ cat > first.sh << ENDAnd then after press the 'return' buttion, a '>' sign appeared expecting you to input the content. If I type 'END' then the 'return' button, then a new text file is created with what I just typed...I'd like to know what's the differnece in just type:$ cat > first.shwithout the '<<' sign?What '<<' really means? I cannot find it's meaning anywere... seems it's not in the redirection section.
View 6 Replies
View Related
Aug 12, 2010
I want to watch a number of processes in "D" status repeatedly with following command:Code:# watch -n 1 'top -b -n 1 | awk '{if ($8 == "D") {print; count++} } END {print count}''but it didn't work. I also tried with double quote. Can I use 'watch' command is this case?PS: I know 'while' and 'sleep' can do the same but it is dirty workaround.
View 2 Replies
View Related