Search Results

Search: Posts Made By: holyearth
2,771
Posted By holyearth
sed add space X times
Pattern:
Mary walks at the park every day with her children


sed 's/$/ /'

will make it add 1 space at the end (trailing)

I want to add X ($VARIABLE) number of spaces (which comes from...
5,240
Posted By holyearth
iptables to block port 25 only to a certain range
I want to limit all *outbound* traffic on eth0 (or all *.*) on port 25 to a specific (allowed) range...

I.E.
192.168.1.5 (local ip) tries to connect to 1.2.3.4:25 (outside real world ip)

It...
2,107
Posted By holyearth
Thanks, that's a good solution!
Thanks, that's a good solution!
2,107
Posted By holyearth
Grep help (match two strings one line)
Hello,

Here I have some grep command which is not working correctly:

cat file1.txt:
apples
Date: Sun, 24 Feb 2013 8:14:06 -0800
peaches melons
cherry sky cloud
green purple
yellow

cat...
3,884
Posted By holyearth
Test if script was ran w/ nohup
I want to test if script.sh is being run with nohup ... but $0 does not contain nohup part...

purpose: script.sh should only be ran with nohup if user forgets nohup then it should echo "run with...
2,171
Posted By holyearth
sh file: READ (menu) but now run with option
I have a script which uses READ to detect choice of menu option...now I want to change the script without doing whole rewrite such that when user runs ./script.sh 5 it would execute menu option 5...
1,609
Posted By holyearth
Combine lines from file
Hello,

Input file looks like this:
apples
bananas
oranges and rice
pears
cherries
mango

I want output to look like this:
apples bananas
oranges and rice pears
cherries mango

It...
1,908
Posted By holyearth
Hi, thanks for those solutions. I will try them...
Hi, thanks for those solutions. I will try them out.

The purpose is to optimize the method I am doing. I think it's not as efficient as it could be.
1,908
Posted By holyearth
sed delete but save deleted output into other file
Hi guys, I am currently using this to save first 50 lines into top50.txt and delete them from list.txt ... it's 2 commands:

head -n 50 list.txt > top50.txt && sed -i "1,50 d" list.txt

I want to...
2,288
Posted By holyearth
Thanks, really good suggestions/examples in this...
Thanks, really good suggestions/examples in this thread. This is not for homework but an actual script I am doing.
2,288
Posted By holyearth
While loop depends on variable
The variable N is set upon start of script so while loop runs and keeps running because N is not being updated when loop is running:

N becomes less than 9 but it still runs (should be "done").......
15,374
Posted By holyearth
ok guys, solved, thanks!
ok guys, solved, thanks!
15,374
Posted By holyearth
If file exists count lines
Hello,

Currently I have:

FILE=/home/file.txt

if [ -f $FILE ];
then
echo "File $FILE exists"
else
echo "File $FILE does not exist"
fi
exit


I would like to make it such that...
2,590
Posted By holyearth
Thanks Agama!
Thanks Agama!
2,590
Posted By holyearth
Hi Agama, Thank you for that, but it seems a...
Hi Agama,

Thank you for that, but it seems a bit complicated...

This is working atm...


# Random character generator
randomizer()
{
randomize=`cat /dev/urandom | tr -dc "a-z0-9" | fold...
2,590
Posted By holyearth
Gen random char then sed replacements
Hey guys,

I need to first generate some random characters, which I am already doing perfectly as follows:
randomize=`cat /dev/urandom | tr -dc "a-z0-9" | fold -w 6 | head -n 1`

This is where I...
1,568
Posted By holyearth
This is an example input: blank2@blank.com ...
This is an example input:
blank2@blank.com
blank44@blank.com
blank221@blank.co
blank233@blank.com

Output should be:
blank2@blank.com
blank44@blank.com
blank221@blank.com
blank233@blank.com...
1,568
Posted By holyearth
sed change text
Hello,

I have sed to change improperly entered email address such as:
blank@blank.co --> blank@blank.com (it should be)

I am using this:
sed 's/blank.co/blank.com/g'

Problem is it makes...
1,152
Posted By holyearth
oh I got it...thats what I wanted was to define a...
oh I got it...thats what I wanted was to define a function....I'll test that out...

Thanks!

---------- Post updated at 10:38 PM ---------- Previous update was at 09:47 PM ----------

Thanks,...
1,152
Posted By holyearth
Hi rdcwayx, With the case command how does...
Hi rdcwayx,

With the case command how does it know that option 2 and 3 are the same command just one thing different the variable declared $DIR?


Thanks,
Holyearth
1,152
Posted By holyearth
run cmd based on input
Hi, This is what I have so far but it seems like a lot more than is necessary because....for example...user presses 2 or 3 ..... the script does the *same* thing it just depends on the directory it...
2,284
Posted By holyearth
Compressing several directories
Could someone help with the easiest command to compress several directories and files?

For example, I want two directories:
/var/www/logs/
and
/var/www/zones/

and this file:...
7,230
Posted By holyearth
Sh script to run multiple php scripts
I wrote a .sh script to run 5 php scripts. The problem is that it's running 1 then 2 then 3 in that order .... I want it to execute all 5 at ONCE....

nohup php /home/script1/script1.php && nohup...
2,994
Posted By holyearth
Grep Sed or Awk?
I have two .txt files one called good.txt and the other one is called bad.txt. Both contain email addresses in the following format:

john@john.com
bob@bob.com
sarah@sarah.com

Basically, I...
1,531
Posted By holyearth
awk help
Hi,

I've got a list in this format:
SMITH 2,501,922 1.006 1
JOHNSON 2,014,470 0.81 2
WILLIAMS 1,738,413 0.699 3
JONES 1,544,427 0.621 4
BROWN 1,544,427 0.621 5

I'd like the list to...
Showing results 1 to 25 of 30

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