Search Results

Search: Posts Made By: Lem
9,768
Posted By Lem
Ok. So we have a sequence of chars (a -, then...
Ok. So we have a sequence of chars (a -, then some digits you may want to use for exclusion, then a .) once and only once in each line. So here it is:

#!/bin/bash

inputfile="/tmp/buddyfile"
cp...
9,768
Posted By Lem
In this file "-94" and alike are not at the end...
In this file "-94" and alike are not at the end of lines, as they were before. So no lines were excluded. You got 50% of 5 lines, so 2 lines (2.5 rounds to 2).

If you want a good excluding...
9,768
Posted By Lem
No, 25% is calculated on the remaining lines...
No, 25% is calculated on the remaining lines (after you excluded two lines).
So 25% of 2 is 0.5, which rounds to zero.

Try: ./program Myfile 50 50 52
You'll get 1 line randomly chosen among 2...
9,768
Posted By Lem
#!/bin/bash inputfile="/tmp/buddyfile" cp...
#!/bin/bash

inputfile="/tmp/buddyfile"
cp "$1" $inputfile
(( $# < 3 )) || {
string="-${3}$"
for ((a=4;a<=$#;a++)); do
string+="\|-${!a}$"
done
...
1,894
Posted By Lem
Another way, perhaps in other circumstances,...
Another way, perhaps in other circumstances, could be to use named pipes. For instance:
$ mkfifo cmd1 cmd2
$ exec 2>/dev/null; echo -e "this\nthat" >cmd1 & echo -e "first\nsecond" >cmd2 & paste...
9,768
Posted By Lem
## Let's say that: ## the number of lines in...
## Let's say that:
## the number of lines in your file is 200 (range=200);
## you want 30% of the lines in your file: percent=30.
## So we'll have that lim= 200 * 30 / 100 = 60.

for...
2,015
Posted By Lem
Pardon? I'm sorry, but I don't know a word of...
Pardon? I'm sorry, but I don't know a word of German.
However Google translator helped me a bit, this time. :)

I thought it was your case, and that you didn't have any other directories at level...
4,111
Posted By Lem
Don't you have logrotate (or something alike) in...
Don't you have logrotate (or something alike) in your system?
What's wrong with it?
--
Bye
6,790
Posted By Lem
With sed, try this: sed -n '/^$/b blk;H;$b...
With sed, try this:
sed -n '/^$/b blk;H;$b blk;b;:blk;x;s/\n//;/PATTERN/!P' <file
--
Bye
1,282
Posted By Lem
Without escaping, the expression "s*.txt" matches...
Without escaping, the expression "s*.txt" matches a string that begins with zero or more s, goes on with another char no matter what (matched by the period), then goes on with txt. So it matches...
1,724
Posted By Lem
What about this different approach? The example...
What about this different approach?
The example below is for 4 total instances, 2 of them run simultaneously.
i=0; while((i<=4)); do while (( $(pgrep -c myscript) < 2 )); do let i++ ; nohup...
2,957
Posted By Lem
And what about find? If you don't have file names...
And what about find? If you don't have file names with spaces or strage chars, please try:
#!/bin/sh
for arg in "$@"; do
date | tee -a $(find /var/lib -maxdepth 1 -name "$arg") >/dev/null ...
2,957
Posted By Lem
#!/bin/sh -e cd /var/lib for arg in $@; do ...
#!/bin/sh -e
cd /var/lib
for arg in $@; do
for file in /var/lib/$arg.dat; do
date >> $file
done
done

then call it this way:
sh -f -c "./dummy.sh a*"
--
Bye
3,128
Posted By Lem
I guess your problem can easily be solved with...
I guess your problem can easily be solved with awk alone, but since I don't know awk... :(

A possible alternative solution can be this one: knowing which is the colums delimiter in your file (if...
9,768
Posted By Lem
If I'm right your problem is to randomly generate...
If I'm right your problem is to randomly generate N integers in the range [1;M], where M is the number of lines in the file, and N is a rounded percentage of M.

Before going on: are repetitions...
3,128
Posted By Lem
Something like: cut -d" " -f 4,6 --complement...
Something like:
cut -d" " -f 4,6 --complement infile >outfile

Then check outfile. If it's fine, then:
mv outfile file
--
Bye
2,216
Posted By Lem
if [ -s $FILE ] && (( $(stat -c %s $FILE) >...
if [ -s $FILE ] && (( $(stat -c %s $FILE) > 104857600 )); then
--
Bye
1,958
Posted By Lem
Uhm. What's wrong with: lem@biggy:/tmp$ while...
Uhm.
What's wrong with:
lem@biggy:/tmp$ while IFS="|" read -r T_NAME P_NAME P_CODE _PATH _DATE; do
cat <<END >>outfile
T_NAME $T_NAME
P_NAME $P_NAME
P_CODE $P_CODE
PATH $_PATH
DATE ...
6,879
Posted By Lem
On a browser? Try Free Linux shell access...
On a browser? Try Free Linux shell access (http://simpleshell.com/).

If you can establish a ssh connection, there are plenty of these services.
Search "free shell accounts" in Google.
--
Bye
2,402
Posted By Lem
This should work better: sed...
This should work better:
sed 's/\.*0*\(~[^~]*\)$/\1/' <file
--
Bye
2,402
Posted By Lem
With sed: sed 's/0*\(~[0-9]*\)$/\1/' <file --...
With sed:
sed 's/0*\(~[0-9]*\)$/\1/' <file
--
Bye
3,554
Posted By Lem
Try starting from here: #!/bin/ksh while read...
Try starting from here:
#!/bin/ksh
while read line; do
read -A array <<<$line
n=${#array[@]}
echo "${array[0]} is my function"
for ((i=1;i<$n;i++)); do
print "${array[$i]} is datum"
...
1,858
Posted By Lem
sed -n '/^FAN/ s/.*\[\([^][]*\)\]$/\1/p' <file ...
sed -n '/^FAN/ s/.*\[\([^][]*\)\]$/\1/p' <file
--
Bye
Forum: Filesystems, Disks and Memory 09-04-2012
10,356
Posted By Lem
From what I've been reading about those...
From what I've been reading about those ShareSpace devices, there should be an LVM2 volume, indeed, on top of the raid. So you should find it, and then mount it. If things are like that, of course...
Forum: Filesystems, Disks and Memory 09-03-2012
10,356
Posted By Lem
From mdadm man: So you can --examine...
From mdadm man:


So you can --examine /dev/sdf4, for instance, not /dev/md2. And you can --detail /dev/md2, not /dev/sdf4. :)



Wait. We were speaking about a raid volume. This is for LVM(2)...
Showing results 1 to 25 of 38

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