Search Results

Search: Posts Made By: DeCoTwc
2,333
Posted By DeCoTwc
Trapping a kill command sent to a script and using it to send an EOF to a subprocess before killing
I originally had a script written in pure shell that I used to parse logs in real time and create a pipe delimited file that only contained errors. It worked but it was using a lot of memory (still...
1,569
Posted By DeCoTwc
Oh...son of a...seriously? So how come I...
Oh...son of a...seriously?

So how come I need this extra set of brackets now, but I don't need it when I forgo the function and just print the info I need? I'm trying to walk through this step by...
1,569
Posted By DeCoTwc
Trying to learn to use functions in gawk and not getting expected output.
I've been working on improving my awk, and the next thing I want to learn is to properly use functions (I understand functions in shell and python). I have the following code which includes how I did...
8,835
Posted By DeCoTwc
Disclaimer: I'm somewhat a novice to python. I...
Disclaimer: I'm somewhat a novice to python. I prefer spaces, but my understanding is that tabs are better. If you use spaces, and some else wants to read your code, and they don't use spaces,...
1,599
Posted By DeCoTwc
I believe below will get you what you're looking...
I believe below will get you what you're looking for.

d@AirBox:~$ v1=($(awk -F\: '{print $1}' file))
d@AirBox:~$ v2=($(awk -F\: '{print $2}' file))
d@AirBox:~$ for ((i=0 ; i < ${#v1[@]} ;...
6,638
Posted By DeCoTwc
Someone already posted a very elegant awk...
Someone already posted a very elegant awk solution, so this is just because I like trying to solve things in pure shell.

i=1;while read -a line;do line[4]=$i;echo "${line[@]}";let i=i+1;done <...
1,746
Posted By DeCoTwc
Yeah, one of the downsides of only learning bits...
Yeah, one of the downsides of only learning bits and pieces of different languages is I never learned how to construct a proper program, so everything is a one-liner to me. It's kind of fun though. ...
1,746
Posted By DeCoTwc
Looking to improve the output of this awk one-liner
I have the following awk one-liner I came up with last night to gather some data. and it works pretty well (apologies, I'm quite new with awk, and don't know how to format this pretty-printed). You...
1,620
Posted By DeCoTwc
Just a note (and my personal opinion) while this...
Just a note (and my personal opinion) while this is a good exercise, YOU SHOULD NOT ALIAS RM. The last thing you want to do is forget how powerful it is, and more importantly how permanent it is....
4,373
Posted By DeCoTwc
Only because I can't sleep... lsvg -o |...
Only because I can't sleep...


lsvg -o | while read VG
do
lsvg -l $VG | while read -a x
do
case "${x[6]}" in
(closed)
echo $VG ${x[5]} Closed
;;
(*)
echo $VG...
1,804
Posted By DeCoTwc
You can use variables in for loops, but not...
You can use variables in for loops, but not inside of a {}. Someone else can probably do a better job of explaining this, but the bottom line is it has to do with the order in which the shell...
3,660
Posted By DeCoTwc
Awesome. And there shouldn't be a significant...
Awesome. And there shouldn't be a significant (given the scale of what's happening already) time lost from rsync having to rebuild the file list initially? That took quite a while the first time, and...
3,660
Posted By DeCoTwc
Is it better/possible to pause the rsyncing of a very large directory?
Possibly a dumb question, but I'm deciding how I'm going to do this. I'm currently rsyncing a 25TB directory (with several layers of sub directories most of which have video files ranging from 500...
11,972
Posted By DeCoTwc
Neither one of these is really perfect, as it...
Neither one of these is really perfect, as it leaves the period placement wonky. You could fix it, but this seems like kind of a silly exercise to put that much effort into.
...
1,554
Posted By DeCoTwc
You need double brackets. ...
You need double brackets.


(00:10:48\[root@DeCoBoxOmega)
[~]$ cat search
xaaax
xxxxx
cbbbc

(00:10:58\[root@DeCoBoxOmega)
[~]$ cat help
if [[ x`grep q search` = x ]] && [[ x`grep i...
4,299
Posted By DeCoTwc
Just a note, if you have zgrep, you probably have...
Just a note, if you have zgrep, you probably have zfgrep which is faster, but doesn't support any kind of regex. But, if you're just looking for a string, go with [z]fgrep
6,599
Posted By DeCoTwc
Perfect. That works perfectly (in your original...
Perfect. That works perfectly (in your original post you didn't say the -- required the - infront of the pid as well) . I updated the killScript function to:

killScript ()
{
/usr/bin/find...
6,599
Posted By DeCoTwc
Either I'm not understanding your suggestion, or...
Either I'm not understanding your suggestion, or I'm not doing it properly.


[root@liwmgmt02 ~]# ps -ef|grep [n]ew.log
root 13507 7458 0 19:57 pts/1 00:00:00 bash ./new.logGen.sh
root...
6,599
Posted By DeCoTwc
A script that kills previous instances of itself upon running not killing child processes
I'm likely going to explain this clumsily, so apologies in advance:

I have the following script:

#!/bin/bash

pidPrefix="logGen"


checkPrime ()
{
if /sbin/ifconfig eth0:0|/bin/grep...
19,153
Posted By DeCoTwc
I'm not quite sure what the issue you're having...
I'm not quite sure what the issue you're having is. It seems the solution Bartus posted should work. For funsies though, you could probably do it like this:

(19:12:02\[root@DeCoBoxOmega)...
1,525
Posted By DeCoTwc
Just to be clear, the reason that: for i in...
Just to be clear, the reason that:

for i in {1..${array }}

Doesn't work is that brace expansion is the first thing that the shell tries to process *before* it's converted the variable into an...
4,551
Posted By DeCoTwc
Depending on what you're trying to do, this could...
Depending on what you're trying to do, this could be a good use for lock files. There's a bunch of different ways you could do it. But based on the simplicity of your example, the easiest way would...
2,415
Posted By DeCoTwc
Offtopic, but this is the best thread I've ever...
Offtopic, but this is the best thread I've ever seen on this site. The question was phrased perfectly. in detail, with what has been attempted, input and desired output. The help offered, and the...
921
Posted By DeCoTwc
If you want people to help you, you should use a...
If you want people to help you, you should use a descriptive topic name, so people have an idea of if it's in their area of expertise. Additionally include a sample of your input, desired output and...
4,725
Posted By DeCoTwc
Bah, you're right on both counts. I read the man...
Bah, you're right on both counts. I read the man page, and that part about the expansion being done first, but it just didn't register. I think what was throwing me off was that it **did** show the...
Showing results 1 to 25 of 160

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