Search Results

Search: Posts Made By: MadeInGermany
225
Posted By MadeInGermany
ls | sed -n 's/^status_\(.*\)[.]log$/\1/p'
ls | sed -n 's/^status_\(.*\)[.]log$/\1/p'
338
Posted By MadeInGermany
You can put semicolons instead of newlines. And...
You can put semicolons instead of newlines.
And vice versa; there is hardly a need for a one-liner.
Example string:
echo 'two
lines'
Example shell code:
result=$(
if [ -f...
338
Posted By MadeInGermany
If you know the possible pathnames then you don't...
If you know the possible pathnames then you don't need find and grep.
if [ -f /var/chef/cache/cookbooks/bootstrap_cookbooks_version_green ]
then echo "green"
elif [ -f...
187
Posted By MadeInGermany
Define a file_exists function...
Define a file_exists function (https://www.unix.com/shell-programming-and-scripting/252233-tip-file_exists-function.html).
Then you can do
if file_exists "$dir"/[Ff]ile[Oo]ne.csv
then
...
201
Posted By MadeInGermany
It wants the bare module name - not a pathname. ...
It wants the bare module name - not a pathname.
Set the module search path instead! Like in
Expand Python Search Path to Other Source - Stack Overflow...
167
Posted By MadeInGermany
The echo $a1 | ssh ... redirects stdin - but...
The echo $a1 | ssh ... redirects stdin - but nothing reads from it.
You can just redirect stdin with </dev/null ssh ... or close stdin with ssh -n ...; that should have the same effect and not...
261
Posted By MadeInGermany
You want "$line" to be the input data for sed,...
You want "$line" to be the input data for sed, not a file name.
Is this home work / course work?
347
Posted By MadeInGermany
The OS is Linux, as stated in post #5. Linux...
The OS is Linux, as stated in post #5.
Linux distros have got pgrep/pkill soon after Sun introduced them on Solaris. They were pretty welcome because the traditional Linux commands pidof/killall got...
299
Posted By MadeInGermany
bash does integer arithmetics only. awk...
bash does integer arithmetics only.
awk '{tot+=length+1; spc+=gsub(/[[:blank:]]/,"")+1} END{print spc/tot}' afile
The +1 takes the newline character into account like the previous wc.
347
Posted By MadeInGermany
Yes pkill -u med && sleep 5 && pkill -9 -u med...
Yes pkill -u med && sleep 5 && pkill -9 -u med would be a smart command (the "friendly" kill first).
369
Posted By MadeInGermany
The sed definitely has the "range must span over...
The sed definitely has the "range must span over two or more lines" problem.
Thanks Scrutinizer for showing that awk does not have this restriction.
Also perl does not have this restriction:
perl...
369
Posted By MadeInGermany
A range must span over two (or more) lines. ...
A range must span over two (or more) lines.
With a status variable it may end on the same line:
awk '/Umbist_reverse_inst/ {r=1}; r {gsub(/\(\)/,"")}; /\);/ {r=0}; 1' list
If the start pattern is...
511
Posted By MadeInGermany
The fixes are ^version to require the beginning...
The fixes are ^version to require the beginning of the line, and \" for a " within " ".
Short solutions:
sed "s/^\(version=\).*/\1\"$new_version\",/" filename.txtsed "/^version=/...
Forum: Programming 1 Week Ago
920
Posted By MadeInGermany
BTW in many cases a trim function comes in handy....
BTW in many cases a trim function comes in handy.
For example, the fuzzy strstr() that can match a portion of the string can be replaced with an exact strcmp()
...
//...
Forum: Programming 1 Week Ago
920
Posted By MadeInGermany
The empty line prints str1. Because it was not...
The empty line prints str1.
Because it was not matched in scanf() it has the value from the previous line - therefore the str1= assignment,
should set it to "" with one of
str1[0]=0 or...
Forum: Solaris 1 Week Ago
509
Posted By MadeInGermany
Perhaps some /dev/ links are missing (that point...
Perhaps some /dev/ links are missing (that point to the /devices/ paths)?
man devfsadm
Usually one can do
devfsadm -v -C -c disk
to rebuild the /dev/ links.
437
Posted By MadeInGermany
vLnArray=( $vline ) without quotes does word...
vLnArray=( $vline ) without quotes does word splitting (wanted) and glob matching (not wanted).
A safer method is to let the read do the word splitting, either into discrete variables (see post #2)...
131
Posted By MadeInGermany
The a becomes a_a The following bc remains...
The a becomes a_a
The following bc remains unchanged.
131
Posted By MadeInGermany
The abc is passed to sed. The sed substitutes a...
The abc is passed to sed.
The sed substitutes a by a_a.
& is what matched, and the a matches an a.
416
Posted By MadeInGermany
Perhaps you want for f in CAT_Run??.ica; do ...
Perhaps you want
for f in CAT_Run??.ica; do
test -f "$f" &&
echo mv "$f" "${f#CAT_}"
doneImportant: the arguments to mv (and test) must be in "quotes".
438
Posted By MadeInGermany
[My tcl knowledge is limited,] Do you know the...
[My tcl knowledge is limited,]
Do you know the two values pkram and sysram in advance? Then you can use two globs:
glob -type f modified_rtl_files/*/*{wrapper_hsm_pkram}* and
glob -type f...
Forum: Programming 2 Weeks Ago
920
Posted By MadeInGermany
The str1 variable is too small. "sample10" is 8...
The str1 variable is too small. "sample10" is 8 characters, so str1 must have 8+1=9 bytes wide at least.
char name[256]; //1st part (key part) parsed from each line[]
char str1[12]; ...
Forum: Programming 2 Weeks Ago
920
Posted By MadeInGermany
The code that you provided stops at line 8 with...
The code that you provided stops at line 8 with exit 1:
...
printf("%s: %s\n", name, str1); //puts() always adds newline at the end of the string
//printf("%d\n", i);
...
Forum: Programming 2 Weeks Ago
920
Posted By MadeInGermany
Again it worked for me, with the infile.txt from...
Again it worked for me, with the infile.txt from your post #1.
Perhaps it helps to make your strings more robust:
char line[256]; //for row read from file
char name[256]; //1st...
Forum: Programming 2 Weeks Ago
920
Posted By MadeInGermany
For me it works: the red phrases land in the blue...
For me it works: the red phrases land in the blue variables.
But there can be trailing spaces in name because %[^:] matches up to the :
Showing results 1 to 25 of 500

 

Featured Tech Videos

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