Search Results

Search: Posts Made By: MadeInGermany
152
Posted By MadeInGermany
The shorter pathnames is a small improvement only...
The shorter pathnames is a small improvement only when post processing the output.
Then, you can bundle the names (shortens the command, not so much the run time).
But a + instead of the \; will...
179
Posted By MadeInGermany
The second * in the previous post should be sed...
The second * in the previous post should be
sed 's/^\([[:space:]]*PASS_MIN_LEN[[:space:]]*\)[0-9][0-9]*/\112/' /etc/login.defsAlternatively one can add a filter condition and use the s command:
sed...
431
Posted By MadeInGermany
You can use awk '!a[$1]++' myFile | paste -sd...
You can use
awk '!a[$1]++' myFile | paste -sd "," -
If you want to replace each newline with ", " then
awk '!a[$1]++' myFile | sed -e ':L' -e '$!N;s/\n/, /;tL'
240
Posted By MadeInGermany
If you really want to count, then consider the -c...
If you really want to count, then consider the -c option for grep.
To concatenate outputs from different commands into one file there are 3 methods:
command1 > outfile
command2 >> outfileMore...
180
Posted By MadeInGermany
-mindepth is a global/scope option and must be...
-mindepth is a global/scope option and must be first.
find /home/user_install -mindepth 2 ...
255
Posted By MadeInGermany
As root run history to get root's command...
As root run history to get root's command history.
Check /var/log/secure for system access (through PAM).
/var/log/su* might be special logs fo su/sudo.
91
Posted By MadeInGermany
It works in bash-4 and I am confident that it...
It works in bash-4 and I am confident that it works in bash-5.
Perhaps you have bash-3? Run /bin/bash --version.
Or you invoke your script with "sh script" instead of "/bin/bash script", or you run...
259
Posted By MadeInGermany
To avoid an initial newline one can test for NR>1...
To avoid an initial newline one can test for NR>1 or del==1:
awk '/^Answer:/{del=1} (del==1 && /^NO\./){del=0; print ""} del==0' test.txt
Here comes a portable sed solution:
sed '/^Answer:/{
...
259
Posted By MadeInGermany
The task seems easy: delete the section between...
The task seems easy: delete the section between "Answer:" and "NO."
Doable with sed by means of the N command and a loop. But sed has a portability issue regarding N on the last line.
So awk is the...
1,519
Posted By MadeInGermany
With my proposal the remote shell (e.g. bash)...
With my proposal the remote shell (e.g. bash) runs the input stream - no need to copy/delete any files.
You can even use parameters:
ssh remotehost /bin/bash -s arg1 arg2 < remotescript.sh
arg1...
323
Posted By MadeInGermany
In ksh, as an alternative to tr, you can define...
In ksh, as an alternative to tr, you can define lower case and upper case variables:
typeset -l lhostname
typeset -u uhostname
hostname=$(hostname)
lhostname=$hostname
uhostname=$hostname
echo...
1,519
Posted By MadeInGermany
Some advanced comments (this is the Advanced...
Some advanced comments (this is the Advanced forum)
If you have a string in ' ' and want to have embedded ' ' (for the remote host) then use '\'' for each embedded '
for i in `cat servers`; do ssh...
330
Posted By MadeInGermany
If you also want to print the >id then you can do...
If you also want to print the >id then you can do it with perl:
perl -ne '/^>.*/ and $id=$&; /.{5}AAGC[^T].{16}AAGC[^T].{5}/ and printf "%s\n%s\n",$id,$&' gene.fasta
383
Posted By MadeInGermany
A comment: the existence test a[$1] can give...
A comment:
the existence test a[$1] can give different results on different awk versions, and also it adds an empty array element if there was none.
Better is the test ($1 in a).
I think one...
840
Posted By MadeInGermany
What do you do to manually clean up? If you...
What do you do to manually clean up?
If you have a general working sequence of commands then you can put them into a shell script.
If the script has successfully run several times, then the...
106
Posted By MadeInGermany
Two more suggestions: Set IFS only for...
Two more suggestions:


Set IFS only for the read command (unset for other commands)
Use a builtin to omit the first line (and the while loop runs in the main shell, not forced into a sub shell...
431
Posted By MadeInGermany
Your grep seems not precise, perhaps you mean...
Your grep seems not precise, perhaps you mean grep -i '^x.*\.com$' (starts with an x then any amount of characters then .com at the end)
A sed 's/$/,/' does not delete $ because it is an anchor -...
365
Posted By MadeInGermany
What is wrong? Do you get an error? Perhaps...
What is wrong?
Do you get an error?
Perhaps you can loop over the lines:
foreach line ("`cat $att_file`")
echo "do something with '$line'"
end
486
Posted By MadeInGermany
Include the existing trailing spaces in order to...
Include the existing trailing spaces in order to replace(=remove) them:
s/ID3 */$NEW${SPC:${#NEW}}/
A variant with printf:
sed -i "s/ID3 */$(printf "%-10s" "$NEW")/" TESTFILE_TEST
486
Posted By MadeInGermany
Please edit your post #1 and wrap your sample in...
Please edit your post #1 and wrap your sample in CODE tags! (Click on the symbol that looks like </>)
Forum: Shell Programming and Scripting 2 Weeks Ago
696
Posted By MadeInGermany
The following Posix options are available on many...
The following Posix options are available on many OS:
ps -p <pid> -o stime=
But the format of stime is not standardized.
Better is the elapsed time
ps -p <pid> -o etime=
where the format is...
873
Posted By MadeInGermany
Give the process name! The short name is bash but...
Give the process name! The short name is bash but with -f it takes the full name or a part of it.
pkill -u perm_adm -f CHECK_PORT_PROCESS_MAIN.sh && sleep 5 && pkill -9 -u perm_adm -f...
590
Posted By MadeInGermany
Framed, and hanging in my office.
Framed, and hanging in my office.
Forum: Shell Programming and Scripting 2 Weeks Ago
765
Posted By MadeInGermany
Replace all || with ,, sed 's/||/,,/g'
Replace all || with ,,
sed 's/||/,,/g'
710
Posted By MadeInGermany
ls | sed -n 's/^status_\(.*\)[.]log$/\1/p'
ls | sed -n 's/^status_\(.*\)[.]log$/\1/p'
Showing results 1 to 25 of 500

 

Featured Tech Videos

All times are GMT -4. The time now is 11:42 AM.
Unix & Linux Forums Content Copyright 1993-2019. All Rights Reserved.
Privacy Policy