You are not logged in.
Greetings!
I apologize for the cluttered post, I'm not sure how to explain this in a more convenient manner. I have two pls files I want to parse with grep:
$ls *.pls
classic-rock-live.aac.pls space.pls
I'd like to parse them, so I have lists of links from those files. I do this:
$ egrep -o http.* space.pls
http://voxsc1.somafm.com:8200
http://mp2.somafm.com:8200
This works fine so far, but when I try to parse the other file, nothing happens, as in I get no output, just an empty line:
$ egrep -o http.* classic-rock-live.aac.pls
However, parsing both files at once works as expected:
$ egrep -o http.* *.pls
classic-rock-live.aac.pls:http://mp3channels.webradio.antenne.de/classic-rock-live.a
space.pls:http://voxsc1.somafm.com:8200
space.pls:http://mp2.somafm.com:8200
Besides the missing "ac", it should read "classic-rock-live.aac". I thought maybe the combination of i3 and urxvt ate something, so I made the terminal window fullscreen and tried again.
$ egrep -o http.* *.pls
space.pls:http://voxsc1.somafm.com:8200
space.pls:http://mp2.somafm.com:8200
Now the classic rock stuff is gone, only a blank line remains. Well, I thought, maybe it's the combination of urxvt and i3, i thought, so I tried the same command on a tty with the same result:
$ egrep -o http.* *.pls
space.pls:http://voxsc1.somafm.com:8200
space.pls:http://mp2.somafm.com:8200
Now it's getting interesting: When I used tmux to tile the window, so the width was smaller or equal the length of the string I expected, grep showed the string. The moment the string was shorter than the console width, grep showed nothing.
I stored the pls file here for forensic analysis.
Is this a known "feature"? I could not find anything about this behavior, maybe I'm just lacking the right keywords. What's going on?
I made another test:
$ egrep -o http://.* classic-rock-live.aac.pls | xargs
http://mp3channels.webradio.antenne.de/classic-rock-live.aac
It seems like grep actually parses the file correctly, but bash fails to display the output. Could anybody grab the file and make some tests, maybe on another distro as well, so I know whether to report a bug or not? Can anybody think of another test I could run to identify, whether it's bash or grep?
EDIT: A few generations of updates of most of the relevant packages fixed the problem.
Last edited by Awebb (2014-07-21 12:10:54)
Offline
I downloaded the linked file, and in urxvt running bash
~/downloads$ egrep -o http.* *.pls
http://mp3channels.webradio.antenne.de/classic-rock-live.aac
I also tested in xterm, same functional result.
Could there be an issue with the line-endings? What happens if you cat the file in the terminal?
Last edited by Trilby (2012-07-20 15:45:04)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
If I cat the file, everything is fine. I can use sed to manipulate the file.
Now I did this:
$ grep http://.*aac classic-rock-live.aac.pls
File1=http://mp3channels.webradio.antenne.de/classic-rock-live.aac
grep suddenly shows the whole line. Note that it parses the whole line nevertheless, as we have proven by piping it into xargs.
Could you please, just for the sake of completeness, give the file name to grep as well, instead of *.pls'ing? I'm curious now.
EDIT: I also doublechecked to see if it writes the result in the same color as the background, it does not; there definitly is nothing. I also checked my .bashrc, but there was nothing of relevance.
Last edited by Awebb (2012-07-20 15:59:54)
Offline
Odd.
Here you go:
$ egrep -o http.* classic-rock-live.aac.pls
http://mp3channels.webradio.antenne.de/classic-rock-live.aac
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Strange stuff.
$egrep -o http.* *.pls
http://mp3channels.webradio.antenne.de/classic-rock-live.aac
$ egrep -o http.* classic-rock-live.aac.pls
http://mp3channels.webradio.antenne.de/classic-rock-live.aac
One thing I thought of though: do you have other files, specifically files named 'http.'*, in your directory?
Then this error is indeed understandable:
$ touch http.foobar; egrep -o http.* classic-rock-live.aac.pls
$ touch http.foobar; egrep -o 'http.*' classic-rock-live.aac.pls
http://mp3channels.webradio.antenne.de/classic-rock-live.aac
Quoting the expression is, in this case, essential.
Offline
Nope, there are a few files in the folder, but nothing with http.
$ la
total 548K
drwxr-xr-x 3 itsme users 4,0K 20. Jul 17:58 .
drwxr-xr-x 5 itsme users 4,0K 18. Jul 10:27 ..
-rw-r--r-- 1 itsme users 179 5. Mai 2009 classic-rock-live.aac.pls
drwxr-xr-x 2 itsme users 4,0K 29. Jun 23:19 Doomicide-luakit-adblock-6ab1a92
-rw-r--r-- 1 itsme users 6,9K 18. Jul 21:20 Doomicide-luakit-adblock-6ab1a92.tar.gz
-rw-r--r-- 1 itsme users 378 17. Jul 23:52 space.pls
-rw-r--r-- 1 itsme users 519K 20. Jul 15:31 usenixsec2012-rubberhose.pdf
If it was just a wrong command, then the width of the terminal would not make a difference and xargs wouldn't produce output.
@Trilby: Thanks, it looks like I'm the only gay eskimo in my tribe this time. -.-
Last edited by Awebb (2013-07-08 15:03:46)
Offline
Old thread cleanup day. I'm marking this ancient thread as solved. The machine does not exist anymore, I have not encountered the bug again after updating the device a couple of months later (but very well before). Whatever it was, an update fixed it long ago.
Offline