are these threads moderated ?
can we get rid of these useless "man command" comments??
my common method is one of these:
cat input | tr ' ' '\012'
or
### works for all non-printable characters.
cat input |
sed -e 's/[^ -~]/ /' \
-e 's/ */ /g' |
tr ' ' '\012'
my answer would be not to mess with cron, but
to create a go/no-go file somewhere on the system
where the cron-job first looks before it executes.
or put the decision to run/not-run in the script itself or
a wrapper script.
no reason to get fancy here.
LOGCONTENTS=`grep \`date +%Y-%m-%d\` | grep -i "[n][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"`
cat /tmp/logs | ${LOGCONTENTS} > /tmp/test
The answer is to simplify your script like so:
date +%Y-%m-%d | read yymmdd
cat /tmp/logs |
grep $yymmdd |
grep -i...
<Device dev_name="0853" status="Ready" configuration="RAID-5">
I would use the following:
grep Device |
awk '{print $1}' |
sed -e 's/"//g' |
cut -d= -f2
This way it's very clean and every step is very straightforward.
how's this ? I was puzzled by the fact that you
set your RS and FS to the same character...
But anyway, try this in a script:
#!/bin/ksh
file=$1
cat $file |
tr '^C' '\012' |
grep Sterling > GBPT
# Then, same thing opposite:
cat $file |
tr '^C' '\012' |
grep -v Sterling > NEWT
# eof...
Jake99,
Try this one, the first line must be the first
line in the script:
#!/bin/ksh
# Go to where my files are:
cd /target_dir/
# List all my files, pipe to my processing loop.
/bin/ls -1 |
while read file_nm ; do
echo Processing $file_nm
case $file_nm in
*.dat) echo...
Losing carriage controls is a common theme when messing around with emulators. I offer the following tips:
Hitting CONTROL-J ~should~ still give you a carriage control. So you should be able to do things like:
% ls CONTROL-J and get some results.
Make sure that your "export...
We like to split jobs like this into the 2 tasks that they truly are.
Step 1: Rename the files:
/bin/ls -1 MO-*-p |
sed -e 's/\(.*\)p$/mv \1p \1c;/' |
ksh
You can test the command builder first without piping
to ksh.
Step 2: Edit the new files:
/bin/ls -1 *c |
head |
while read file ...
And finally, in order to stop opening and
closing your output file every time ( which
definitely effects performance for larger
tasks ), put the redirection on the outside
of the loop ( available in ksh:
#!/bin/ksh
for i in $(ls price_file_pattern)
do
sort $i | head -12 | cut -d' ' -f1
done...
Dickie Bird's solution didn't work on my computer,
which is a sun box.
Anyway, you can always create your own little script
and add the control character in vi using the sequence:
CONTROL V, CONTROL M
When done, the script should look like:
sed -e 's/^M//g' $input_file > $input_file.fmt
Or...
I was attempting to build a porting program from MS to UNIX.
I was reading the *.dep file in order to ascertain the
-I include paths for compilation. Suddenly, MSVC++ decides
to replace all directory paths with the string $(INCLUDE).
I have no idea WHERE this is coming from, nor why it suddenly...
In ksh and sh, the last process id put into background is stored in the environmental variable: $!
In csh, I don't believe that's available except through
some heroic grepping of the ps command.
ps -deaf | fgrep $$ | etc....
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.