Search Results

Search: Posts Made By: MadeInGermany
535
Posted By MadeInGermany
In ksh88 (and bash) you can emulate f [[ ( $a...
In ksh88 (and bash) you can emulate
f [[ ( $a =~ sss[0-9]*$ ) ]]
with
if [[ $a == *sss* ]] && [[ ${a##*sss} != *[!0-9]* ]]
And
f [[ ( $a =~ ^sss[0-9]*$ ) ]]
with
if [[ $a == sss* ]] && [[...
195
Posted By MadeInGermany
Looks like a little bug. crontab filename...
Looks like a little bug.
crontab filename should check that filename exists and is a regular file (not a directory, device node, or other special file).

Just crontab (without arguments) should...
356
Posted By MadeInGermany
Is df /backup/Bckup_180320.tar &giving a...
Is
df /backup/Bckup_180320.tar &giving a result?
If it hangs hard, then there is some serious trouble. Then do further diagnostics, e.g. check mounts with
mount | grep /backupNot responding to...
303
Posted By MadeInGermany
The previous post is only for GNU sed that is...
The previous post is only for GNU sed that is compiled with a recent glibc that has got the \S \s from perl (PCRE (https://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions)).
If you want...
535
Posted By MadeInGermany
Of course it is [[ $string2 =~ ROS[0-9]+$ ]]...
Of course it is

[[ $string2 =~ ROS[0-9]+$ ]] && echo OK || echo NOK
Minimum one digit.
700
Posted By MadeInGermany
After studying the man page myself I have come to...
After studying the man page myself I have come to the conclusion that pax wants to either read files from a filesystem or write files to a filesystem or both.
So my first perception was wrong - pax...
Forum: Shell Programming and Scripting 3 Weeks Ago
1,914
Posted By MadeInGermany
As Scrutinizer said, %q is likely not portable. ...
As Scrutinizer said, %q is likely not portable.
And, %q solves a problem that would deserve a better solution.
The natural delimiter for piped input is a newline.
So perhaps you can use that?
Try...
Forum: Shell Programming and Scripting 3 Weeks Ago
1,914
Posted By MadeInGermany
Use an echo_ function...
Use an echo_ function (https://www.unix.com/shell-programming-and-scripting/283413-tip-better-echo.html?highlight=tip)
and set ECHO=echo_!
496
Posted By MadeInGermany
Do you have the command that does it (once)? ...
Do you have the command that does it (once)?
Then you can put it into crontab with an appropriate schedule.
Read about the crontab with
man crontab
752
Posted By MadeInGermany
Good to know. Bash was first with brace...
Good to know. Bash was first with brace expansion, now ksh and zsh are ahead. Let's see when bash will catch up again.
BTW, Bash-4 has got a number + field alignment expansion:
echo {01..10}
01 02...
1,157
Posted By MadeInGermany
Furthermore, sed gets the $line as a filename. ...
Furthermore, sed gets the $line as a filename.
If it should get it as input then do
echo "$line" | sed ...
Some shells (bash, zsh) take as well
sed ... <<< "$line"
1,157
Posted By MadeInGermany
Simply use two s commands: sed 's/.*\$\$//;...
Simply use two s commands:
sed 's/.*\$\$//; s/\..*//' test.txtIn the case there is no $$ it will still remove everything after a dot.
The following would avoid that:
sed '/.*\$\$/ { s///;...
810
Posted By MadeInGermany
GNU sed and maybe BSD sed support ExtendedRE with...
GNU sed and maybe BSD sed support ExtendedRE with a - r or -E option.
Then you can do a universal search:
sed -i -r '/(^|,)GETaboutUsCSS(,|$)/d' file
At the left side there must be either the...
455
Posted By MadeInGermany
A more detailed explanation follows. The main...
A more detailed explanation follows.
The main awk code runs for each input line.
!a[$0]++ is ultra-condensed, quick and dirty.
A bit more explicit is !($0 in A) { A[$0]; print }:
If not $0 in...
810
Posted By MadeInGermany
Have a ^ anchor for the beginning of the line,...
Have a ^ anchor for the beginning of the line, and a $ anchor for the end of the line:
sed -i '/^GETaboutUsCSS$/d' file
1,655
Posted By MadeInGermany
Nice solution :cool: For symmetry reason (and...
Nice solution :cool:
For symmetry reason (and the border case "empty input file") it should be END {printf DL}.
3,853
Posted By MadeInGermany
I think you have ksh-88. You can augment your...
I think you have ksh-88.
You can augment your script(s) with a wrapper function (located somewhere at the beginning):
set_A(){
typeset varname=$1
shift
if [ "$BASH" ]
then
eval "$varname=(...
958
Posted By MadeInGermany
I think you expect rename -> prename as is the...
I think you expect rename -> prename as is the case on Debian. Another one with prename:
prename -n 's/^(CMRLPCR\d{6})_[^_]*/$1/' *.bumOr
prename -n 's/_[^_]*//' CMRLPCR??????_*.bum
The rename...
530
Posted By MadeInGermany
awk -F, 'a[$1]++==0' filenameis quick and dirty...
awk -F, 'a[$1]++==0' filenameis quick and dirty because it stores an unnecessary integer value.
The full and efficient code is
awk -F, '!($1 in a) { a[$1]; print }' filenameThat you can condense...
3,527
Posted By MadeInGermany
As I suggested, have -name "*.js?*" \! -name...
As I suggested, have -name "*.js?*" \! -name "*.jsp" or cheat with -name "*.js??*".
And most easy is of course -name "*.jsp?*".
993
Posted By MadeInGermany
%06s is obviously not portable. On different OS...
%06s is obviously not portable.
On different OS I get different results:
printf "%06s\n" 01140
01140printf "%06s\n" 01140
001140However, never this is seen as a number.

--- Post updated at...
1,294
Posted By MadeInGermany
2&>1 creates a file named 1 in the current...
2&>1 creates a file named 1 in the current directory.
2>&1 is correct: it redirects descriptor 2 (stderr) to descriptor 1 (stdout). The & makes the following a file descriptor.
And the following |...
846
Posted By MadeInGermany
logrotate is awful. man logrotatedoes not well...
logrotate is awful.
man logrotatedoes not well enough clarify boarder cases.
Try to add
sharedscripts
This ensures that the postrotate action occurs once.
It work as well (or even better) to...
1,914
Posted By MadeInGermany
You mean the extra line? I guess there is a...
You mean the extra line?
I guess there is a space character after the server3; this extra space is converted to an extra newline.
1,044
Posted By MadeInGermany
The ~ expands to an absolute path. If your tar is...
The ~ expands to an absolute path. If your tar is not GNU tar, then the leading / is not stripped off. And a relocation during extraction is impossible.
I would use cd and let the shell expand the...
Showing results 1 to 25 of 500

 

Featured Tech Videos

All times are GMT -4. The time now is 12:37 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy