Unix/Linux Go Back    

Showing results 1 to 25 of 500
Search took 0.09 seconds.
Search: Posts Made By: MadeInGermany
Forum: HP-UX Linux 23 Hours Ago
Replies: 9
Views: 772
Posted By MadeInGermany
One of the few occasions you should not quote a...

One of the few occasions you should not quote a variable in command arguments. To avoid unwanted expansions set -f (noglob) and set IFS to only a newline.
# PATH=/bin:/usr/bin:/path/to/gzip
#...
Forum: UNIX for Beginners Questions & Answers Linux 1 Day Ago
Replies: 5
Views: 98
Posted By MadeInGermany
Perhaps you mean Enterprise storage versus...

Perhaps you mean Enterprise storage versus Desktop storage?
Reasons are here (https://serverfault.com/questions/263694/why-is-enterprise-storage-so-expensive).
The most important difference is...
Forum: UNIX for Beginners Questions & Answers Linux 1 Day Ago
Replies: 6
Views: 98
Posted By MadeInGermany
The following has got some more fixes, e.g. it...

The following has got some more fixes, e.g. it allows the PROBES sections to be last, and would even handle two PROBES sections.
awk '
NR==FNR {nodes[$1]; next}
NF>1 && $1=="NODE" {node=$2;...
Forum: UNIX for Beginners Questions & Answers Linux 1 Day Ago
Replies: 6
Views: 98
Posted By MadeInGermany
In many awk versions (including GNU awk version...

In many awk versions (including GNU awk version 4.x) the gsub(,,$2) on a not present $2 does define $2 i.e. it sets NF to a higher value.
A workaround is to make sure that $2 exists:
NF>1...
Forum: Shell Programming and Scripting Linux 4 Days Ago
Replies: 8
Views: 144
Posted By MadeInGermany
Some sed versions (BSD ?) have introduced option...

Some sed versions (BSD ?) have introduced option -E that does the same as the -r in GNU sed.
IMHO the -E is more intuitive because it is used for grep in the same way: use ERE instead of BRE.
Forum: Shell Programming and Scripting Linux 5 Days Ago
Replies: 3
Views: 98
Posted By MadeInGermany
Traditionally there was a difference between SysV...

Traditionally there was a difference between SysV su and BSD su, only the latter sets USER (and LOGNAME does not exist).
Portable is only su - that is a kind of login shell that sets LOGNAME (if...
Forum: Shell Programming and Scripting Linux 5 Days Ago
Replies: 8
Views: 144
Posted By MadeInGermany
You can still have an embedded sed script. All...

You can still have an embedded sed script.
All shells but (t)csh can have a multiline string
echo 'two
lines'
So the following should work
gfind . -depth -name "somefile" -type f -writable -exec...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 4
Views: 116
Posted By MadeInGermany
@rovf, passing environment variables is an...

@rovf, passing environment variables is an interesting alternative, but is not needed here because the expect script is prepared in the shell.
In detail, the shell substitutes the shell variables by...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 8
Views: 169
Posted By MadeInGermany
The following deletes a :something/hope/something...

The following deletes a :something/hope/something that follows a PASS= at the beginning of the line.
sed -n 's#\(^PASS=[^ ]*\):[^: ]*/hope/[^: ]*#\1#p' fileThe -n option suppresses the default...
Forum: UNIX for Beginners Questions & Answers Linux 1 Week Ago
Replies: 4
Views: 130
Posted By MadeInGermany
ps -el lists all the processes.

ps -el
lists all the processes.
Forum: UNIX for Advanced & Expert Users Linux 1 Week Ago
Replies: 1
Views: 201
Posted By MadeInGermany
I think you better put the 60 second supervision...

I think you better put the 60 second supervision into the child code, i.e. replace the system() with code that installs such a signal / -handler and execve() so it directly receives the signal....
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 8
Views: 169
Posted By MadeInGermany
What did you try, and what wrong output did you...

What did you try, and what wrong output did you get?
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 2
Views: 110
Posted By MadeInGermany
It is because awk substitutes \ in strings. For...

It is because awk substitutes \ in strings. For example
nawk 'BEGIN {print "\a"}' </dev/null
nawk 'BEGIN {print "\b"}' </dev/nullSo within " " you need \\ for a literal \
Therefore, you better...
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 19
Views: 328
Posted By MadeInGermany
A \n an embedded newline character (not two...

A \n an embedded newline character (not two consecutive characters \ and n).
sed loops over the lines in the input file, so the sed code only has one line in its "pattern space".
The \n character...
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 19
Views: 328
Posted By MadeInGermany
RudiC's idea (with hold space), optimized, as...

RudiC's idea (with hold space), optimized, as multi-liner with comments
# sed -n : no default print
sed -n '
# if line starts with 1, then
/^1,/ {
# exchange with hold space
x
#...
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 19
Views: 328
Posted By MadeInGermany
As you found out, it uses the hold space with the...

As you found out, it uses the hold space with the commands h H x
The hold space is a bit cumbersome because line 1 and the last line $ need special treatment. (Indeed my solution without the hold...
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 19
Views: 328
Posted By MadeInGermany
Another one-liner with sed (all versions) sed...

Another one-liner with sed (all versions)
sed -e ':L' -e '$!N;/\n1,/{P;D;}' -e 's/\n/|/;tL' fileBetter readable as multi-liner
sed '
:L
$!N
/\n1,/{
P;D
}
s/\n/|/
tL
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 3
Views: 125
Posted By MadeInGermany
The main code loops over all rows. Perhaps you...

The main code loops over all rows.
Perhaps you want to sum up each row but print only once, at the END?
awk 'BEGIN { s=0 } { s=s+$1 } END { print s }'
Or, cast an empty s to a zero
awk '{ s=s+$1...
Forum: UNIX for Advanced & Expert Users Linux 2 Weeks Ago
Replies: 2
Views: 165
Posted By MadeInGermany
The % character is magic in crontab, one needs...

The % character is magic in crontab, one needs to backslash-escape it.
Within ' ' one needs to put the \% outside, for example
echo 'this is a % sign'must become
echo 'this is a '\%' sign'in...
Forum: Shell Programming and Scripting Linux 3 Weeks Ago
Replies: 4
Views: 261
Posted By MadeInGermany
Must be something else. But have no idea. In...

Must be something else. But have no idea.
In what context did you find it?
Forum: Programming Linux 4 Weeks Ago
Replies: 6
Views: 542
Posted By MadeInGermany
The recursion seems strange. Better go for an...

The recursion seems strange.
Better go for an iteration: an outer loop with counter, and two loops inside (one fwd then one bk).
BTW this is not shell code...
Forum: UNIX for Beginners Questions & Answers Linux 4 Weeks Ago
Replies: 3
Views: 170
Posted By MadeInGermany
Quick answer ls -ltr The last updated files...

Quick answer
ls -ltr
The last updated files are listed last.
Forum: Shell Programming and Scripting Linux 03-17-2018
Replies: 8
Views: 291
Posted By MadeInGermany
Perhaps the number recognition is broken? Then...

Perhaps the number recognition is broken?
Then a cast to a string would help
if ($1"" == $2"")
Forum: Shell Programming and Scripting Linux 03-16-2018
Replies: 1
Views: 229
Posted By MadeInGermany
Start on one server, connect with ssh, and make a...

Start on one server, connect with ssh, and make a script that finds the old files and produces a suitable output file.
Forum: Shell Programming and Scripting Linux 03-16-2018
Replies: 5
Views: 294
Posted By MadeInGermany
Please use code tags in your posts! -- If you...

Please use code tags in your posts!
--
If you want all variable=value pairs from a.txt then you better process it in a while loop.
filenames=`cat $tmpfile`
while IFS="=" read var value
do
[...
Showing results 1 to 25 of 500

 


All times are GMT -4. The time now is 04:58 AM.