Search Results

Search: Posts Made By: LivinFree
175,305
Posted By LivinFree
See the man page for test. if [ -s...
See the man page for test.

if [ -s $file_name ]; then
echo Yay
else
echo Boo
fi

That will Yay if the file exists, and has a size greater than zero, and Boo if the file does not exist, or...
156,548
Posted By LivinFree
If you're using newer versions of GNU sed:sed -i...
If you're using newer versions of GNU sed:sed -i 's/2006/2007/g' file
12,606
Posted By LivinFree
Your $DISPLAY variable is not getting set for...
Your $DISPLAY variable is not getting set for some reason.
7,862
Posted By LivinFree
If you specify . ./file.ksh, it's like running...
If you specify . ./file.ksh, it's like running the contents of that file in your current shell. It's a bit smarter than this, but think of it running:
while read line; do "$line"; done <file.ksh...
8,655
Posted By LivinFree
My first guess would be: #! /bin/bash ...
My first guess would be:

#! /bin/bash

logfile=/path/to/logfile
while read ip; do
zgrep "$ip" $logfile > output_logfile_${ip}
done <iplist


It could be done more elegantly, and maybe...
3,427
Posted By LivinFree
What is your input filename and expected output...
What is your input filename and expected output filename set?

As a proof of concept, assume I put your example in "tmp.in" and ran this script:

#! /bin/bash

declare i=1
while read line; do ...
7,028
Posted By LivinFree
This works in bash: echo ${PWD##*/} ...
This works in bash:

echo ${PWD##*/}


[Edit: Derp - I somehow missed everyone else's replies. Sorry for the repeat.]
7,028
Posted By LivinFree
I'd buy Bill Joy a beer for vi, but punch him...
I'd buy Bill Joy a beer for vi, but punch him halfway through the round for NFS and csh.

I guess we shouldn't blame him completely, though. NFS and csh were good for their time - it's those lousy...
1,294
Posted By LivinFree
Here's my crack at it, although if you're working...
Here's my crack at it, although if you're working with huge files, it might not be a great idea to load that much into the Hold buffer:

sed -n '1h;2,$H;${g;s/\n/\t/g;s/\tReceiver/\nReceiver/g;p}'...
1,666
Posted By LivinFree
It depends on your shell. Which shell are you...
It depends on your shell. Which shell are you using?

Assuming from the syntax that it's sh, bash, ksh, or similar, check for a .profile, .bashrc, or .bash_profile in your home directory -...
2,879
Posted By LivinFree
It has to do with how your shell expands the...
It has to do with how your shell expands the command.

Try this, assuming you're in the same directory as the file:

# mv ./-X ./dash-X


Then you can examine or remove the 'dash-X' file.
10,496
Posted By LivinFree
What about using "ed", or "ex"? Say, you had a...
What about using "ed", or "ex"?
Say, you had a list of files and directories in a text file named tmp.list.
If you wanted to get rid of all items matching "Desktop" (the same as using "grep -v...
19,293
Posted By LivinFree
Well, grep is certainly the best way to search...
Well, grep is certainly the best way to search through a file... combined with options that allow you to only display the name of the files that contain the search string, it'd be hard to duplicate....
Showing results 1 to 13 of 13

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