Reputation
2,071
Top tag
Next privilege 2,500 Rep.
Create tag synonyms
Badges
6 12
Newest
 Custodian
Impact
~243k people reached

1d
comment Select the lines with exactly two columns in Linux
@snowbell : don't forget to upvote every answer that you find useful, and also to accept the one you think answers your question the best (wait a few days usually, to allow a maybe better answer to arrive)
Feb
9
comment modify file ownership for files inside tar archive
@user1968963: f should always be just before the filename, as it means "the next parameter is the filename". If you don't put it just before the filename, tar will think the filename is "", and then it tries to open a "" file, which it cannot stat (of course).
Feb
9
comment Select the lines with exactly two columns in Linux
I wrote : -F'[\t ]+' . -F redefines awk's FS, awk's Field Separator, to be a regular expression representing "either a Tab or a space, repeated 1 or more times". Thus, every time awk sees some spaces and/or tabs, it sees them as a field semarator, and whatever is behind them is the next field (or column, if you will). And you want at least 2 fields, so you want field number 2 to be non empty. (Note that the first field could be empty, so i prefer the latest version, testing also the first field)
Feb
8
revised Select the lines with exactly two columns in Linux
gentler remark
Feb
8
revised Select the lines with exactly two columns in Linux
added 209 characters in body
Feb
8
comment Select the lines with exactly two columns in Linux
@Snowbell : It didn't show any output because it contained always 2 fields separated by 1 tab. However, try the latest version : it should work if you have TABs or if you have SPACES, in both cases.
Feb
8
revised Select the lines with exactly two columns in Linux
added comment on the last example
Feb
8
reviewed Approve playing a sound/notification in finch over ssh on my local machine
Feb
8
comment Select the lines with exactly two columns in Linux
if it didn't work, it may be because you don't have just a tab ? or no tab at all?
Feb
8
revised Select the lines with exactly two columns in Linux
added 56 characters in body
Feb
8
answered Select the lines with exactly two columns in Linux
Feb
8
awarded  Custodian
Feb
8
reviewed Approve Installation of Pacemaker Corosync on RHEL Server 6.6
Feb
2
comment BASH: how to pass a default argument if no arguments after the first were passed
@mikeserv: the poster tests only the 2nd arg, and say "no argument" (without s). If there can be more than 2, then if [ "$#" -lt 2 ]; then echo "Not enough arguments supplied: you need at least 2"; fi will be fine. The point of my comment being still the same: testing for the 2nd argument's length doesn't tell you how many arguments were supplied...
Feb
2
comment BASH: how to pass a default argument if no arguments after the first were passed
I'd rather say [ "$#" -ne "2" ] , as you could very well pass an empty 2nd argument : myscript foo "" bar baz # has 4 args, and the arg $2 is empty
Jan
28
answered Remove extra header lines from file, except for the first line
Jan
21
comment Why did find with -delete erase the files in my /save/ directory when find without delete was not able to locate them?
1000 thanks to you. Code (often?) works in mysterious ways...
Jan
21
comment Why did find with -delete erase the files in my /save/ directory when find without delete was not able to locate them?
Ouch ... I learned something today (thanks to you). And I recommend a simple mv save/ ../some/safer/location prior to such a "generic" delete command (... but of course, prior to your post I'd have done the same check and ran into the same trouble!). Now go find a good "undelete" for the filesystem the files were on ^^
Jan
20
comment On what systems is //foo/bar different from /foo/bar?
@DevSolar: really interresting (and surprising), but we should stick to POSIX only, as out of POSIX anything is possible ^^
Jan
20
comment On what systems is //foo/bar different from /foo/bar?
standard (pubs.opengroup.org/onlinepubs/009695399/basedefs/…) says, as you mentionned, "A pathname that begins with two successive slashes may be interpreted in an implementation-defined manner" (more than 2 resolves to 1 /). An exemple found on the net : austingroupbugs.net/view.php?id=83 ( IBM's z/OS resolves //pathname requests to MVS datasets (as opposed to the hierarchical filesystem (HFS)) (......) Additionally, z/OS would not accept or recognize additional "directory" or "file" components appended to such paths.... not exactly unix, though ^^).