Search Results

Search: Posts Made By: ryran
11,388
Posted By ryran
awk or sed: change the color of a column w/o screwing up column spacing
Hey folks. I wrote a little awk script that summarizes /proc/net/dev info and then pipes it to the nix column command to set up column spacing appropriately.

Here's some example output:
Iface ...
6,681
Posted By ryran
If you don't get any responses, you might be...
If you don't get any responses, you might be better off posting this at python-forum (http://www.python-forum.org/pythonforum/index.php).
4,449
Posted By ryran
Open the man page and search for "no header" and...
Open the man page and search for "no header" and you'll find the right option.
4,449
Posted By ryran
Well you already have been using -f .... and it...
Well you already have been using -f .... and it should be obvious what -C does, but yes... check the man page (or just try it out).
4,449
Posted By ryran
As you say, learning is great, so why don't you...
As you say, learning is great, so why don't you just look at the ps man page? You're wasting your time with grep.

ps -fC sched
1,656
Posted By ryran
You want this user to ONLY be able to connect via...
You want this user to ONLY be able to connect via ftp? They don't need to log in to a shell on the system? Also, you didn't say what kind of nix. Everything you want is possible, and there are...
22,866
Posted By ryran
Well you didn't say using what, so I'll stick...
Well you didn't say using what, so I'll stick with the ever-wonderful bash. Set your outputfile name and then run the script as ./scriptname "INSERT YOUR COMMAND HERE" or simply edit the YOURCMDHERE...
9,879
Posted By ryran
verdepollo gave you the right answer based on...
verdepollo gave you the right answer based on what you told us. Perhaps you didn't understand that it was prompting you to say "y" to delete each file? Now that you've added a wrinkle to things, with...
1,726
Posted By ryran
I'm sorry man. I love sed, and I use it for all...
I'm sorry man. I love sed, and I use it for all kinds of things, but I would never use it for this. ... I don't understand how it's being used here, and I don't quite care to try and muddle through...
5,987
Posted By ryran
Man that's awesome. To the original poster:...
Man that's awesome.

To the original poster: Carlo could give all the details, but the big difference I see between the two solutions he gave is that one grabs the first occurrence of a line, and...
5,987
Posted By ryran
If you're okay with the new file not including...
If you're okay with the new file not including timestamps, it would be really simple:
sed 's/#####:TM.*//' file | sort -u > newfile

If you need timestamps, I can offer this BASH snippet, but it...
29,072
Posted By ryran
In case you're referring to the "." in the 3rd...
In case you're referring to the "." in the 3rd field:

awk '$7 == "." {next}; $3 == "." {$3 = "-1"} {print}' file
27,570
Posted By ryran
HOLY CRAP! 3.5 years since I started learning nix...
HOLY CRAP! 3.5 years since I started learning nix (and bash)--how the heck have I not seen this before! Wow. Thanks for the taking the time radoulov.

@barrydocks: Why do you want to remove dots...
27,570
Posted By ryran
Awesome. I knew what IFS was, but I had never...
Awesome. I knew what IFS was, but I had never changed it before, and the whole leading/trailing spaces being stripped thing didn't occur to me before you mentioned it. Thanks for taking the time to...
1,726
Posted By ryran
Well... It's a cluster. The person who wrote it...
Well... It's a cluster. The person who wrote it seems to me to be insane. ;)

cat /etc/passwd | grep "^[^:][^:][^:][^:]:"
This greps for lines beginning with "XXXX:", where X is any character...
27,570
Posted By ryran
Very nice radoulov! I'm a bash dude and was...
Very nice radoulov! I'm a bash dude and was familiar with ${VAR/MATCH/REPLACE/} syntax but didn't know about all the extra details, so was a bit confused at first. For anyone else that's looking for...
4,488
Posted By ryran
[linux] tail2notify - script interface between tail -f + grep and notify-send
This isn't exactly a question. Just thought I'd share something I just wrote and found useful.

For those of you on modern linux boxen: you may be aware that there's a lovely little tool called...
832
Posted By ryran
Assuming ALL your 12 files begin the same, this...
Assuming ALL your 12 files begin the same, this would work:
sed -i "1s/H|......../H|$(date +%Y%m%d)/" FILES*
3,001
Posted By ryran
Let me start with a question: Why are you so...
Let me start with a question: Why are you so concerned about 1GB of space? ... Or: why are you so opposed to swap? I think you should read the link dude2cool posted. It looks like it's a good page of...
2,293
Posted By ryran
Or, even simpler, your script can create files in...
Or, even simpler, your script can create files in a tmpfs that resides on a ramdisk that you already have on your computer, assuming you're using linux (you didn't say).

You can google about this...
9,011
Posted By ryran
As an addendum to Corona's words of wisdom: ...
As an addendum to Corona's words of wisdom:
Look up what the letters in "fifo" traditionally stand for, if you don't already know.

If you want to see a simple real-world example, check out a...
5,403
Posted By ryran
First thing to try would be to protect that...
First thing to try would be to protect that asterisk from your local shell, i.e.: \*.dem, "*.dem", or '*.dem'
Forum: Fedora 12-16-2011
5,863
Posted By ryran
As Corona said, this REEEEALLY depends what...
As Corona said, this REEEEALLY depends what flavor of linux + version you're running. For example, if you're running a recent version of Fedora, you won't see anything like that in /etc/inittab....
1,633
Posted By ryran
In addition to what they said, since you're...
In addition to what they said, since you're starting out and already mentioned you're using BASH: Don't use the classic shell builtin '[ expression ]' ; use the shell keyword '[[ expression ]]'....
7,948
Posted By ryran
First thought: Why in the world is this a perl...
First thought: Why in the world is this a perl script?
Second thought: don't use ls -h: some files might have a suffix of M; some G (etc). No good.
Third thought: Why are you doing this? Whatever...
Showing results 1 to 25 of 37

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