Printf - Columns/Tables I've learned how to make nice neat colums/tables with printf. var1="gem" var2="frenchbread" var3="z" printf "%-5.3s%-5.3s%-5.3s\n" $var1 $var2 $var3 gem fre z var1="pp" var2="all" var3="jamboree" printf "%-5.3s%-5.3s%-5.3s\n" $var1 $var2 $var3 pp all jam var1="toe" var2="lettuce" var3="rock" p... 28 Mar 2010 17:52
xgawk script for display xml tags and data I have a data.xml file which I want to extract the data to a display-friendly format. I searched the web and find xgawk and a sample script, outline.xgawk, which could do half what I want. This script resulted in outlining the xml tags only. OUTPUT (see below) - xml tags only; I want data to be displayed as ... 28 Mar 2010 12:21
Delete some records based on "ISP_NAME" or "DOMAIN_NAME". Hi all, I've the following file which includes three fields in each line: "IP_ADDRESS" "ISP_NAME" "DOMAIN_NAME" "109.86.226.38" "-" "-" "117.18.75.235" "SUNNYVISION LIMITED" "SUNNYVISIONDATACENTRE.COM" "119.11.13.169" "-" "-" "119.11.42.164" "-" "-" "121.44.240.31" "INTERNET SERVICE PROVIDER" "ON.NET" "122.... 30 Mar 2010 08:18
Can a shell script determine if its output will be redirected? Suppose I write a Bourne shell script and find later that I want to grep its output as in: ./script | grep "$re" Is there any way that I can determine in the shell script that a pipe swallow the output? I want to vary following events (following the output) if a pipe exists on the command line. Thanks. ... 10 Apr 2010 20:07
bash printing variable with newlines In a bash script I have a variable called recs recs="this is line 1\r\nThis is line 2\r\nthis is line3\r\n" Actually recs gets loaded via ssh like this but the sample i am showing is correct: recs=$(ssh other_sys cat xp_share/records.txt) and recs ends up containing a lot of lines delimited this way The \r\n... 28 Mar 2010 11:15
Make stderr -> stdout & stdout -> /dev/null How do I make the STDERR go to STDOUT whilst nullifying the STDOUT from any command? This doesn't work: command 3>&1 1>&2 2>&3 3> /dev/null I am going thru this rigamarole as I want to test for the existence of a file in a portable manner. test -e is not available on Solaris. So I am doing thi... 27 Mar 2010 01:10
sed -f me at wrote: Hi, This works great in vim, :v,^New,d to delete all lines that do not begin with "New" Please tell me the sed equiv so I can put it into my #!/bin/sh script that I call from the command line with sed -f /^New/!d sed '/^New/!d' ... 29 Mar 2010 19:12
bash: how to flush the output from command `tee` Below is my pipe line under bash(RHEL5): /path/to/my_script.sh 2>/dev/null | tee /path/to/log_file I want to check the output from script '/path/to/my_script.sh' immediately without having to wait for the buffer to be full. Is there any bash configuration to handle this and only to this script [not to the ... 25 Mar 2010 20:53
Interpreting a script without executing it In article <4B67F4E6.9060303(a)clermont.in2p3.fr>, Medernach <medernach(a)clermont.in2p3.fr> wrote: Ben Finney wrote: .... Ok, I could run it on a virtual space and see after that what it has modified Please, whata is a virtual space? Thanks, David ... 25 Mar 2010 10:16 |