glenn jackman

Ottawa, Canada

Developer at Pythian.
Big Tcl and Perl fan.
Enjoy Ruby and JavaScript too.

8h
answered What is the config file for the sh shell on OS X? (i.e., ~/.bash_profile for bash shell, etc)
8h
comment PS1 variable inheritance between scripts and programs using bash in AIX
You'll probably want system("$SHELL -li") to have it source your login config files. Many programs hardcode /bin/sh as a "system shell": in that case, you have no control.
8h
revised BASH: determine which of three strings is in a file
typo
8h
answered Grep a pattern and also print the header of the file
16h
comment Using Bash to Extract IP Addresses From Each Line of Log File
I see that you haven't accepted answers to any of your questions. Please see stackoverflow.com/help/someone-answers
17h
revised Redirections shell
formatting
17h
revised Using Bash to Extract IP Addresses From Each Line of Log File
added 1 character in body
17h
answered Using Bash to Extract IP Addresses From Each Line of Log File
17h
comment Using Bash to Extract IP Addresses From Each Line of Log File
So fix your typo
18h
comment Match first next word matching a given pattern using sed
If you know the argument has no whitespace, you could write: sed 's/.*--key1 ([^[:blank:]]\+).*/\1/' but that's a big assumption IMO.
19h
answered Match first next word matching a given pattern using sed
20h
answered Replace part of a string Shell Scripting
1d
comment reverse a file in Unix shell
rev is not applicable to this particular problem. printf "%s\n" abc def ghi | tac versus printf "%s\n" abc def ghi | rev
1d
comment reverse a file in Unix shell
The point is to reverse the fields on each line, not reverse the lines in the file.
1d
comment reverse a file in Unix shell
Simpler, replace printf '\n' with echo
1d
comment reverse a file in Unix shell
use rev to reverse lines
1d
comment reverse a file in Unix shell
You'll need to chomp, and xargs seems needlessly complicated: ruby -ne 'puts $_.chomp.split(",").reverse.join(",")' parse.txt
1d
answered reverse a file in Unix shell
1d
answered How to hardcode answers to multiple prompted questions following a single command in a bash script?
1d
comment How to continue in nested loops (after 2nd innerloop) in BASH?
Your code is inscrutable. I smell an XY problem: forget about your code and tell us what are you trying to do.
1 2 3 4 5