39,626 reputation
446112
bio website
location Living in Marseille, France
age 34
visits member for 2 years, 2 months
seen 3 hours ago

Elected moderator on Unix & Linux. Feel free to @ping me in chat if there's anything I can help you with.

I've been using Linux since the late '90s and have gone through a variety of distributions. At one time or another, I've been a user of Mandrake, SuSe, openSuSe, Fedora, RedHat, Ubuntu, Mint, Arch and for the past few years Linux Mint Debian Edition (which is basically Debian testing but more green).

My Linux expertise, if I can grace it with such a lofty title, is mostly on manipulating text and regular expressions since that represents a large chunk of my daily work.

profile for terdon on Stack Exchange, a network of free, community-driven Q&A sites


16h
answered Dash equivalent of self-redirection of script output
17h
comment Dash equivalent of self-redirection of script output
Could you clarify what you need exactly? You can redirect with > in dash. I realize you seem to be asking for something else but I can't quite tell what it is.
17h
comment Changed terminal permissions
@user89161 please edit your question to add extra information, it is hard to read and easy to miss in the comments. That said, the issue is indeed what I suspected and my answer should solve it. Note the root in the output, that means that the files belong to root and you don't have access to them. The command I gave will change the ownership back to your user.
17h
answered Changed terminal permissions
17h
comment How Stephane found Shellshock
This question appears to be off-topic because it is about a particular person's thought process and not any specific *nix issue.
18h
comment Why does BASH process substitution not work with some commands?
+1 for the gcc workaround but I'm not sure about your point concerning files. The <() format should act like a file for all intents and purposes. In fact, I don't know of any commands that expect a file that won't be happy with <(). The ones that don't work are those that expect file names, not files. For example, grep -f expects a file and works fine with <().
20h
revised How can I make a read-only Linux system (which uses unionfs) read/write for the duration of upgrades?
edited tags
20h
comment Convert XML to SQL INSERT statements using the command line
Could you explain what how this works? Especially the first xmllint command which produces not output on my system. Also, even if this does work, it will only work for one table and value, presumably, if the OP needed to ask this, their real data will be much larger.
20h
comment Convert XML to SQL INSERT statements using the command line
Will you never have more levels than that? Is your entire XML file always one level deep with the outer label being the table title?
1d
reviewed Reject suggested edit on How to convert multiple XCF files to PNG?
1d
answered Using grep/awk/sed to sort and combine 2 files
1d
comment Linux log file structure change, abnormal (?) sed behaviour
@mikeserv well obviously! If the last field contained spaces, it wouldn't be the last field. In that case, I would not have suggested this solution. I repeat, again, that sed 's/.* //' does actually fail on the OP's data. Try it. Specifically, note the results on the 3rd block of the OP's example that contains trailing spaces. And I agree about them pesky little machines, show 'em who's boss every now and then.
1d
comment Linux log file structure change, abnormal (?) sed behaviour
@mikeserv of course, my point was that the simple awk '{print $NF} will print the last field irrespective of whether you have tab or space delimited data or whether you have extra space after the last field. The almost as simple sed 's/.* // will not work if the whitespace is not a space and it will also not work if you have trailing spaces. Of course sed can deal with that, but as you say, you need to think about it while awk behaves that way by default. Which is why it's easier to use when dealing with columnar data. You still haven't told me how awk fails by the way.
1d
comment Linux log file structure change, abnormal (?) sed behaviour
@mikeserv how does awk fail? I tested on the OP's example and it works as expected, as do the rest of my suggestions. The sed (or anything that uses a regex) is more complex because of the spaces after the last field on some lines. That's where your 1st sed approach also fails. Awk, on the other hand, deals with that kind of thing gracefully since any field delimiters (spaces here) after the last field are simply ignored. Plus, it can deal with tabs which your sed will choke on. Anyway, I never said it's the best tool, I said it's the best tool for dealing with data in columns.
1d
revised Does bash return anything when it runs a command?
deleted 9 characters in body
1d
answered Does bash return anything when it runs a command?
1d
answered Linux log file structure change, abnormal (?) sed behaviour
1d
comment How to pass commandline arguments larger than 131k?
I think what's unclear here is that there are many ways to share data between a host and a guest OS, storing it in variables seems like a very hard way of doing it. Could you explain what kind of data you are talking about, how you set it to the variables, what OS your host is etc? Why not save to a file for example and share the file?
1d
answered search a command in PATH with the same name of the script
1d
revised search a command in PATH with the same name of the script
added 4 characters in body