Search Results

Search: Posts Made By: BMDan
3,351
Posted By BMDan
Can you supply an example of your intended...
Can you supply an example of your intended output? Unfortunately, "index" could have multiple meanings, so it's somewhat difficult to imagine what you'd like to see.

Also, are you only willing to...
36,265
Posted By BMDan
bash-3.00$ cat compare.sh #NOTE : 1.Filename...
bash-3.00$ cat compare.sh
#NOTE : 1.Filename must not have space for the script to work.
# 2.Script wont work if symlinks are there instead of proper filenames.

#!/bin/bash
#set -x
...
2,290
Posted By BMDan
Well, the exec* family of functions never...
Well, the exec* family of functions never returns, so there's your first problem.
1,331
Posted By BMDan
I'll start you off: use a single "=" for...
I'll start you off: use a single "=" for assignment; a double ("==") is for comparison. Also, you have an unmatched "esac".
2,426
Posted By BMDan
For example (requires "find" with maxdepth...
For example (requires "find" with maxdepth option, and off the top of my head and untested, so no guarantees):

PATH1=/home/data1
PATH2=/home/data2
PATH3=/home/data3
PATH4=/home/data3 #should...
2,426
Posted By BMDan
Without changing the way your program currently...
Without changing the way your program currently works, try:

PATH1=/home/data1
PATH2=/home/data2
PATH3=/home/data3
PATH4=/home/data3


for path in $PATH1 $PATH2 $PATH3 $PATH4; do
for i in...
2,177
Posted By BMDan
Are they calling it as "lp <file>"? If so, and...
Are they calling it as "lp <file>"? If so, and if you have Bash 3.0+, just place this earlier in the path than the real lp (or alias it, or... etc.):

#!/bin/bash

if [[ x"$1" =~ '.*\.cpp$' ]];...
7,614
Posted By BMDan
I suspect that you missed the joke. If you...
I suspect that you missed the joke.

If you can provide specific information on the inputs you have and the outputs you'd like to get, I can be of significantly more assistance.
9,605
Posted By BMDan
What is: done < $user intended to accomplish?...
What is:
done < $user
intended to accomplish?

Without going too deeply into your code, let me just point you in the right direction: each "if" needs a "then" and a "fi", and each "while" needs...
2,261
Posted By BMDan
Not clear why there's a colon at the start; is...
Not clear why there's a colon at the start; is this vim? Here's how to do it in vim:
:%s/Mg\([24]\).\(q[np]s[b]?\) W=0\.175u/Mg\1.\2 W=wmg\1\2/g
5,690
Posted By BMDan
Er... something like this: if [ $(pidof httpd |...
Er... something like this:
if [ $(pidof httpd | awk '{print $2}') -gt 50 ]; then
echo Too many httpd processes.
fi
Again, if you have any actual input/output, we can help.
2,689
Posted By BMDan
Always with the neat sed tricks! /me files that...
Always with the neat sed tricks! /me files that one away.

Thanks,
Dan
5,690
Posted By BMDan
What are your inputs? How are they generated? ...
What are your inputs? How are they generated?

What are your (desired) outputs?
2,689
Posted By BMDan
Insert {file,stdin} between delimiters
I'm working with a file like:
somestuff
somemorestuff
...
someadditionalstuff
STARTTAG
ENDTAG
someotherstuff
somecoolstuff
...
somefinalstuffI've got some text (either in a file or piped)...
4,822
Posted By BMDan
Imagine someone is searching these forums. They...
Imagine someone is searching these forums. They want to put a "for" command in a script. They see a title, "How can I place a for statement..."; how does this help them know if that thread will be...
3,839
Posted By BMDan
Because the teacher will give you an F? Why? ...
Because the teacher will give you an F? Why? Even if you're not root, you can always install Perl in your home directory.

Why is it important to do the cut?

Can you provide some sample input?
5,826
Posted By BMDan
perl -ne 'if($.%2){$t=$_;} if(!$.%2){chomp;print...
perl -ne 'if($.%2){$t=$_;} if(!$.%2){chomp;print "$_ $t";}' <file
Shortened that a bit for you.
2,944
Posted By BMDan
Haven't had a chance to test it, but how about: ...
Haven't had a chance to test it, but how about:

sed '/John/ {s/$/(Happy People)/;}'
7,614
Posted By BMDan
/opt/scripts/do_arbitrary_and-or_poorly-specified_...
/opt/scripts/do_arbitrary_and-or_poorly-specified_things.sh:
errpt -a
if [ $? -ne 0 ]; then
/opt/scripts/send_arbitrary_and-or_poorly-specified_emails.sh
fi
5,826
Posted By BMDan
Just for fun, pure shell solution: i=0 while...
Just for fun, pure shell solution:
i=0
while read line
do if [ $(($i%2)) == 1 ]; then
echo "$line $lastline"
else
lastline=$line
fi
let i=$i+1
done
4,944
Posted By BMDan
We cannot and will not help you until you provide...
We cannot and will not help you until you provide the exact text of the commands and scripts you are using. My code works and does not insert extraneous backslashes. Without seeing your code, we...
16,535
Posted By BMDan
/usr/lib/sendmail --help /usr/lib/sendmail -h ...
/usr/lib/sendmail --help
/usr/lib/sendmail -h
man sendmail
info sendmail
5,653
Posted By BMDan
Something like find . -type f | xargs df -s?
Something like find . -type f | xargs df -s?
1,591
Posted By BMDan
grep -B 1 "XXXX"?
grep -B 1 "XXXX"?
3,662
Posted By BMDan
Okay, given the amount of information you gave...
Okay, given the amount of information you gave here, the following are all valid (in increasing order of absurdity):

Since you specified neither flexibility nor name format:
mv...
Showing results 1 to 25 of 63

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