|
More site info...
Shell Programming and Scripting | Forum profile
|
|
Forum profile page for Shell Programming and Scripting on http://www.unix.com.
This report page is the aggregated overview from a single forum: Shell Programming and Scripting, located on the Message Board at http://www.unix.com.
This forum profile page summarizes the general forum statistics such as: Users Activity, Forum Activity, and Top Authors, which are reported in either a table or graph below for a given reporting time period.
Additional forum profile information for "Shell Programming and Scripting" on the Message Board at http://www.unix.com is also shown in the following ways:
1) Latest Active Threads
2) Hot Threads for Last Week
Warning: These statistics are generated using 'best efforts' and can experience delays and reporting errors at times. Please note that such statistics do not constitute a forum's popularity and/or exact posting volumes at any given reporting period.
|
|
|
|
|
Posting activity on Shell Programming and Scripting:
|
|
Week
|
Month
|
3 Months
|
|
Threads:
|
486
|
1,588
|
4,101
|
|
Post:
|
1,681
|
5,335
|
13,848
|
|
|
Shell Programming and Scripting Posting activity graph:
|
Top authors during last week:
user's latest post:
Sort command which ignores NULL...
Published (2009-11-26 05:45:00)
OK now I get what you are driving at. But IMO, the OP did not specify in his first post that there should be a sort on the second field too, plus in his last example he used only sort -u and said it was working fine. That is why I used sort -nu.
user's latest post:
Picking high and low variables...
Published (2009-11-25 15:27:00)
You can do somthing like that : Code: c0=100 c1=12 c2=777 c3=1 clow=$c0 chigh=$c0 (( $c1 < $clow )) && clow=$c1 (( $c2 < $clow )) && clow=$c2 (( $c3 < $clow )) && clow=$c3 (( $c1 > $chigh )) && chigh=$c1 (( $c2 > $chigh )) && chigh=$c2 (( $c3 > $chigh )) && chigh=$c3 echo "Low : $clow"...
user's latest post:
How to get date n months before...
Published (2009-11-25 15:23:00)
If you have GNU date you can do something like: Code: date -d "2 month ago" +%F otherwise you can check one of the links of: Yesterdays Date/Date Arithmetic
user's latest post:
need an AWK code: put in...
Published (2009-11-26 05:44:00)
Try: Code: awk '{ arr[$2]=arr[$2]" "$3; } END { for (i in arr) { print i" "arr[i] >>"Parallel_out"; split(arr[i],ar); printf "%s %.2f",i,(ar[1]+ar[2]+ar[3])/3 >>"avg_out"; }}' < file Output: cat avg_out Quote: 1.0 1.67 4.0 3.73 2.0 3.93 5.0 2.78 3.0 3.41 cat Parallel_out Quote: 1.0 4.00 0.00 1.00 4.0 4.40 4.40...
user's latest post:
Extract a string from file -...
Published (2009-11-26 05:44:00)
Code: while read -r line do case "$line" in *barcode* ) li=${line##*barcode } line=${li%%)*} echo "$line" ;; esac done <"file"
user's latest post:
Extract a string from file
Published (2009-11-26 05:44:00)
Code: sed "s/.*barcode \(.\{6\}\).*/\1/" infile
user's latest post:
Replacing tokens
Published (2009-11-26 05:46:00)
Thanks to TonyLawrence Code: YOURVAR=$(echo DateFileFormat | sed 's/\./.\\\\/g') our using backticks Code: YOURVAR=`echo DateFileFormat | sed 's/\./.\\\\/g'`
user's latest post:
Help me with following issue...
Published (2009-11-25 15:29:00)
This is an excellent resource about how to use pv, and install pv in different platforms..... A Unix Utility You Should Know About : Pipe Viewer - good coders code, great reuse
|
|
|
|
Latest active threads on Shell Programming and Scripting::
Started 14 hours, 5 minutes ago (2009-11-27 05:38:00)
by thegeek
from the man page, it is -p and not p.
Code:
-ep Don't create directories while extracting.
-o+ Overwrite files when extracting.
-o- Don't overwrite files when extracting.
-p Decrypt archive using a password.
Started 14 hours, 42 minutes ago (2009-11-27 05:01:00)
by ghostdog74
Code:
while IFS= read -r line
do
case "$line" in
FHEAD*) echo "${line:0:19}$(date +%Y%m%d)${line:27}";;
THEAD*) echo "${line:0:15}$(date +%Y%m%d)${line:23}";;
*) echo "$line";;
esac
done <"file"
Started 14 hours, 25 minutes ago (2009-11-27 05:18:00)
by thegeek
Quote:
Originally Posted by sexyTrojan
(it doesn't work somehow). Thanks in
Do you get some errors ?
Or no errors, and no expected behavior ( not copied also ? ).
This executes cp for me in the remote server:
Code:
ssh root@192.168.1.33 "cp test-script /tmp/t.tttt"
the test.script is ...
Started 1 day, 3 hours ago (2009-11-26 16:39:00)
by radoulov
Code:
awk > main.txt 'NR == FNR {
n = split($0, t, "\ 047")
fmt[NR] = t[4]; next
}
{
for (i=1; i<=NF; i++)
printf "%-*s", fmt[i], $i
print ""
}' config.txt temp.txt
Started 15 hours, 4 minutes ago (2009-11-27 04:39:00)
by popescu1954
steps:
connection to server 2
cd /develp/temp
ftp server1
send user, password
cd /temp
get file_name a.lst
quit
Started 16 hours, 4 minutes ago (2009-11-27 03:39:00)
by pandu25
you can use any of the following. But don't put space between variable name and command.
CONEXION_BAGDAD=`grep-c "Please login with USER and PASS" $ LOG_FILE_BAGDAD`
CONEXION_BAGDAD=$(grep-c "Please login with USER and PASS" $ LOG_FILE_BAGDAD)
Started 18 hours, 3 minutes ago (2009-11-27 01:40:00)
by honglus
I want to filter 2nd column = 2 using awk
Code:
$ cat t
1 2
2 4
$ VAR=2
#variable worked in print
Code:
$ cat t | awk -v ID=$VAR ' { print ID}'
2
2
# but variable didn't work in awk filter
Code:
$ cat t | awk -v ID=$VAR '$2~/ID/ { print $0}'
Started 1 day, 14 hours ago (2009-11-26 05:39:00)
by thegeek
in bash, it is one of the simplest way to form your file name ...
Code:
todaydate=`date +%d%m%Y`
echo $todaydate
file=imp_$todaydate
echo $file
output:
Code:
25112009
imp_25112009
if you want to run it daily automatically, call it normally from cron.
Started 1 day, 8 hours ago (2009-11-26 11:39:00)
by bigearsbilly
team members?
are you people geting paid?
Started 1 day, 14 hours ago (2009-11-26 05:40:00)
by dennis.jacob
You can use the find
Ex:
Code:
find dir_name -type f -exec rm -f {} \;
Awk doesn't haev any mechanism to delete file/files. However, you can make use of system("command").
|
|
Hot threads for last week on Shell Programming and Scripting::
Started 3 days, 20 hours ago (2009-11-23 23:34:00)
by mkastin
Code:
$ echo "secret1 secret2 serect3" | awk '{gsub(/[a-z]/,""); print $0}'
1 2 3
Started 1 week, 2 days ago (2009-11-18 15:08:26)
by Franklin52
One way:
Code:
sed 's/^| |//' file > newfile
Started 6 days, 18 hours ago (2009-11-21 01:06:43)
by rdcwayx
for example, you need gzip a folder,
Code:
tar cvf - FOLDER_NAME |gzip > /PATH/Separete_file. tar.gz
Started 1 week ago (2009-11-20 16:43:00)
by dsravan
I have a file which is comma delimited. I have around 35 fields in each row. The problem is in the 21st field I have data separated by ; I need the data in only the 21st field separated by ; to be replaced by |. This is a very big file and I need something in awk that its much faster than regular commands. Can anybody tell exactly how I can only achieve this for 21st field.
Started 1 week ago (2009-11-20 02:51:00)
by scottn
You can use quotes to preserve the newline.
i. e.
Code:
echo " $files_found "
Started 1 week ago (2009-11-20 02:47:00)
by abhinav192
Hi all,
In a script like :
job_date=....
ls -l 2>/dev/null |
awk -v var =$job_date '
/Name\.Version\.[0-9]+\.xml$/ {
How can i include a script variable job_date store in "var" in the pattern " /Name\.Version\.[0-9]+\.xml$/ "
Thanks in advance
Started 1 week, 1 day ago (2009-11-19 12:10:00)
by ghostdog74
Code:
awk -F"," 'NR==1{n=NF}NF<=n{n=NF}END{print n}' file
Started 1 week, 2 days ago (2009-11-18 12:08:46)
by cdunavent
I'd like to create a report that is sent to me via email. It's basically just an ls -l of a directory. However, I'd like to add a column to the end of each file listing that is a numeral - telling me at a glance how old the file is.
For example, instead of this:
$ ls -l
total 9830796
-rw-r--r-- 1 voicem voicem 2011396608 Oct 21 03:06 file1....
Started 1 week, 1 day ago (2009-11-18 21:06:48)
by achak01
Friends, I have to find out the greatest amoings three values using awk. Actually i have to run the iostat -d command on my linux box for 5 or 6 iterations and print the largest value for tps at each iteration
for e.g
Code:
iostat -d 3 3
Linux 2.6.18-8.el5 (abhijit) 11/19/2009 _i686_ (2 CPU)
Device: tps Blk_read/s ...
Started 1 day, 14 hours ago (2009-11-26 05:41:00)
by justbow
Hi,
i have the log attached. Actually i want the long space just become 1 space left
like this :
Quote:
20091116 08:29:18+0800 8540 "pmain" 32.50 8.90 541809 1720080 1472264 4 12.00
20091116 08:29:18+0800 4662 "pmain" 22.10 3.10 1210 613864 511748 3 28.00
20091116 08:29:18+0800 8506 "pmain" 32.90 9.30 548538 1830624 1535508 2 28.00
20091116 08:29:18+...
|
|