Search Results

Search: Posts Made By: freelong
6,276
Posted By freelong
how do I change the email sender if I donot have the -r option?
Hey,

after I check the man page for mail and mailx, I did not find the -r option. But, I have to change the email sender, how can I do it?

Send Mode
mailx [-s subject]...
2,100
Posted By freelong
thanks a lot! It is working on this temp file,...
thanks a lot! It is working on this temp file, and I will test on the official file again on Monday. Thank you so much!

Actually, the double quote, comma are allowed in the comments. Need to think...
2,100
Posted By freelong
Help with data processing, maybe awk
I have a file, first 5 columns are very normal, like "1107",106027,71400,"Y","BIOLOGY",,
however, the 6th columns, the user can put comments, anything, just any characters, like new line, double...
7
3,393
Posted By freelong
It works properly on my machine, I got...
It works properly on my machine, I got "8-17,1".
19,298
Posted By freelong
This is pretty easy one: #!/usr/bin for...
This is pretty easy one:

#!/usr/bin
for file in *_*
do
r_name=${file#*_}
mv $file $r_name
done
1,889
Posted By freelong
read_num(){ echo "please enter a...
read_num(){
echo "please enter a number"
read num
isNum=$(echo $num | awk -v num=$num '{if( num ~ /^[1-9][0-9]*$/ ) {print "0"} else {print "1"}}')
if [[ $isNum...
3,096
Posted By freelong
This works, but a little silly: #!/bin/ksh ...
This works, but a little silly:

#!/bin/ksh
awk 'BEGIN {FS=","}
{
$4="\""$4"\"";
$(NF-2)="\""$(NF-2)"\"";
$(NF-3)="\""$(NF-3)"\"";
OFS=","
print $0 >...
5,524
Posted By freelong
Here is a quick solution, I think the sections...
Here is a quick solution, I think the sections are seperated by a blank line, so set the RS=""; FS="\n"


#!/bin/ksh
read -r heu
awk -v heu=${heu} 'BEGIN{RS=""; FS="\n"}
{
if(match($0,...
11,535
Posted By freelong
Why I still got the error: #!/bin/ksh ...
Why I still got the error:


#!/bin/ksh
cat "num_str.txt" | while read line
do
echo "line:$line"
sub=${line:3:2}
echo "sub:$sub"
#sub=$(expr substr "$line" 4...
11,535
Posted By freelong
my ksh does not support sub=$(line:4:2); I have...
my ksh does not support sub=$(line:4:2);
I have to use sub=$(expr substr $line 4 2);
11,535
Posted By freelong
Just add a simple judgement to see if the sub...
Just add a simple judgement to see if the sub matches \[0-9][0-9]\ or not.

sub=$(expr substr "$line" 4 2)
val=$(expr "$sub" : '\([0-9][0-9]\)')
if [[ -n "$val" ]]; then
...
6,140
Posted By freelong
awk -F "|" '{arr[$1"|"$2]=arr[$1"|"$2]"|"$3} END...
awk -F "|" '{arr[$1"|"$2]=arr[$1"|"$2]"|"$3} END {for(i in arr) print i"|" arr[i]}' filename
2,621
Posted By freelong
Here is another simple one: sed -e...
Here is another simple one:
sed -e 's/([^)]*)//g' 's/\|/;/g' filename
2,621
Posted By freelong
Try this one: awk -F"[()]" '{ gsub(/\|/,...
Try this one:
awk -F"[()]" '{
gsub(/\|/, ";", $0);
n=split($0, arr, /[()]/);}
{for (i=1; i<=n; i++)
if(i%2 == 1)
printf ("%s", $i)
}
{print...
2,690
Posted By freelong
Hi, There are tons of this kind of questions...
Hi,
There are tons of this kind of questions in this forum, why not just search and learn a little bit.

Here is the code:

awk 'NR==FNR {_[$1]; next}
substr($2, 1,3) in _ {print $0}
...
2,048
Posted By freelong
Really, it works fine on my computer. awk '{...
Really, it works fine on my computer.

awk '{
split($5, a, ",");
split($6, b, ",");
for(i=1; i<= $4; i++)
print $1,$2,$3, $4, a[i], b[i]
}' sli.t


X...
1,569
Posted By freelong
save it in a file, then read it in
save it in a file, then read it in
1,509
Posted By freelong
I did not test this one, but you can do it: ...
I did not test this one, but you can do it:

for file in *.csv
do
awk -F"," 'NR==2 {print $1}' ${file} > ${file}_new
done
6,464
Posted By freelong
Try this one: sed 's/./&\ > /120'...
Try this one:

sed 's/./&\
> /120' filename
8,095
Posted By freelong
try this one: awk 'f==0 && /Date: 21/ {f=0;...
try this one:

awk 'f==0 && /Date: 21/ {f=0; getline; f=1}
f==1 && /Date: 21/ {f=0}f' inputfilename
9,145
Posted By freelong
use SED i option.
use SED i option.
5,443
Posted By freelong
Try this one, let me know what you get. awk...
Try this one, let me know what you get.

awk '!/\\$/ { print $0}
/\\$/ {sub(/\\/, " "); printf $0}
END {print ""}' filename
1,822
Posted By freelong
what's your expected result, and your original...
what's your expected result, and your original input file?
15,681
Posted By freelong
awk '/^[0-9]/ { print ""; printf $0} ...
awk '/^[0-9]/ { print ""; printf $0}
!/^[0-9]/ {printf $0}
END {print ""}' filename
3,108
Posted By freelong
awk -F"/" '{for(i=1;i<NF;i++) {printf $i"/"}...
awk -F"/" '{for(i=1;i<NF;i++) {printf $i"/"} print ""}' filename
Showing results 1 to 25 of 49

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