Search Results

Search: Posts Made By: Tytalus
1,032
Posted By Tytalus
Is this close to what you're after : awk...
Is this close to what you're after :


awk '{n=NF;for (i=1;i<=n;i++){t[i]=t[i]" "$i}}END{for (i=1;i<=n;i++){print t[i]}}' tmp1 tmp2
36,821
Posted By Tytalus
or: expr "0000000231" + 0 ...
or:


expr "0000000231" + 0
231
39,783
Posted By Tytalus
man last :)
man last

:)
1,479
Posted By Tytalus
regexp like: [0-9]\.[0-9]\{4\}e[+-][0-9] ...
regexp like:


[0-9]\.[0-9]\{4\}e[+-][0-9]


should work
1,383
Posted By Tytalus
something along the lines of: (rewriting...
something along the lines of:


(rewriting your equation to isolate an iteration:

x=y/ln(3.455613x)
)

# y=1;x=1;for i in {1..100}; do x=$(calc "$y/(log(3.455613*$x))"); echo $x;done...
3,091
Posted By Tytalus
something like: # nawk -F"[_.]"...
something like:


# nawk -F"[_.]" '!/thumb/{print} /thumb/{print "<link>preview_"$2".html</link>"; print "</objects>";print}' infile
<objects/>
<link>preview_0001.html</link>
</objects>...
1,182
Posted By Tytalus
something like: # nawk -F","...
something like:


# nawk -F"," '{($2~"errorcode") ? t[$3]=$2 : s[$3]=$4 }END{for (x in t){print x,t[x],s[x]}}' infile
messageID errorcode sha


should be close to what you're after.

HTH
3,748
Posted By Tytalus
sed '/./,/^$/!d' infile should work for...
sed '/./,/^$/!d' infile


should work for you...
1,212
Posted By Tytalus
using (n)awk: # nawk...
using (n)awk:


# nawk 'NR==FNR{x[$1]=$2;next}{print x[$1]}' map infile
2
45
2
56
98
6598
98
56
56
98
98


HTH
31,782
Posted By Tytalus
of if your grep version doesn't support -A: ...
of if your grep version doesn't support -A:


# awk '/match this/ { print;getline;print}' infile
match this pattern
and print next line


HTH
3,404
Posted By Tytalus
how about: # nawk -F"'" '/FILE=/{gsub("...
how about:


# nawk -F"'" '/FILE=/{gsub(" ","",$2);print $2}' infile
/OPERATIONNEL/SATURNE/PHYS_MOD/NOWCAST/SATURNE_1DAV_20110119_20110120_GRIDKZLN10_R20110126.NC.GZ
2,757
Posted By Tytalus
not quite what you're after, but this snippet...
not quite what you're after, but this snippet should be close - you'll need to tweak the final formatting a little:


# nawk -F, '
{
cl[$2]++
dl[$1]++
el[$2" "$1]=$3
}
END {...
3,106
Posted By Tytalus
does your final "EOL" appear exactly as listed...
does your final "EOL" appear exactly as listed i.e. with no spaces/tabs before it on the line ? (This would cause it to break...)
2,673
Posted By Tytalus
one way: # echo "1234 /PARAMETER_1:text...
one way:


# echo "1234 /PARAMETER_1:text /PARAMETER_2thertext" | sed 's/.*TER_1:\([a-z]*\).*/\1/'
text
1,384
Posted By Tytalus
couple of ways: # str="some message...
couple of ways:


# str="some message (string A) some message (string B) some message (string C) some message (string D) some message (string E)"

# echo $str|nawk -F"[()]" '{print $3}'...
3,310
Posted By Tytalus
check the faq article:...
check the faq article: https://www.unix.com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html

should find what you're after
or use the search functionality...
...
14,444
Posted By Tytalus
# perl -e 'print...
# perl -e 'print scalar(gmtime(1280943608380/1000)), "\n"'
Wed Aug 4 17:40:08 2010


milliseconds vs seconds :-)
3,042
Posted By Tytalus
Assuming standard formatting: # echo...
Assuming standard formatting:


# echo "YUENLONG_20070818.DMP" | nawk -F"[_\.]" '{print $2}'
20070818


or if you know these are the only numerics, but position may be an issue:


# echo...
2,016
Posted By Tytalus
ok... If you want to keep all numbers within...
ok...

If you want to keep all numbers within about +/- 50% of the average, then you could use something like:


x=30;n=234951;o=$(($n/$x));n=$(($n-$o));while [ $x -gt 0 ]; do a=$(($n/$x)); ...
1,319
Posted By Tytalus
couple of ways: # echo...
couple of ways:


# echo "/home/user/backup/scripts/SDW/sql/backup.sql" | sed 's/.*\/\([^\/\.]*\)\..*/\1/'
backup

or

# echo "/home/user/backup/scripts/SDW/sql/backup.sql" |nawk -F"[/.]"...
18,317
Posted By Tytalus
one way: # awk '{printf("%f\n",$1)}'...
one way:


# awk '{printf("%f\n",$1)}' example.txt | sort -n
94.000000
9200.000000
930000.000000
9100000.000000
9600000.000000
950000000.000000



HTH
4,522
Posted By Tytalus
something like this: # cat infile 23...
something like this:


# cat infile
23 15
35 1
23 15

# awk '{h[$1" "$2]++}END{for (i in h){print i,h[i]/NR}}' infile
35 1 0.333333
23 15 0.666667


HTH
4,307
Posted By Tytalus
try: # awk '$2==1{print NR}' file1 10 ...
try:


# awk '$2==1{print NR}' file1
10
21


HTH
1,574
Posted By Tytalus
probably using the key combo ESC-p i.e....
probably using the key combo ESC-p

i.e. type in start of line then hit ESC and p together.

try a "man tcsh" and read the section on history searching.

:-)
Forum: Programming 06-13-2010
1,497
Posted By Tytalus
one way: # sed -e 's/,/ /g' -e...
one way:


# sed -e 's/,/ /g' -e 's/\"\([0-9]*\) \([0-9]*\)\"/\1\,\2/g' infile
0 1 0 87 0 0 6,87 170,03 0 43,5 0 0 0 0 6,87 126,53


HTH
Showing results 1 to 25 of 27

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