i*e 发帖数: 352 | 1 想了两个,不知道可行否
sed 's/s+/t/g; s/t/n/2' inputfile > outputfile
awk -F '[[:blank:]]+' '{OFS="t"; print $1,$2"n"$3,$4}' inputfile >
outputfile |
|
e****e 发帖数: 179 | 2 【 以下文字转载自 Linux 讨论区 】
发信人: engine (boxing cat), 信区: Linux
标 题: help on replacing text in a file
发信站: BBS 未名空间站 (Wed Oct 31 11:42:35 2007)
I would like to replace string 1 with string 2 in file3.dat, here is what I
did:
#!/usr/bin/perl
@inputfile= ("string1");
@outputfile=("string2");
@attfile=("file3.dat");
$mytempfile=$inputfile[0];
$youtempfile=$outputfile[0];
$hisfile=$attfile[0];
perl -pi -e 's/$mytempfile/$youtempfile/' $hisfile;
The program reports an error:
Scalar found where operator ex |
|
|
a********e 发帖数: 15 | 4 tr -d '\r' < inputfile > outputfile |
|
v*****r 发帖数: 1119 | 5 凑个热闹,如果楼主需要切割任意长的文件,scripting is necessary, perl or
python can do the job nicely but a little bit overkill. AWK 是做这种工作的最
好选择之一,只需要一行 code:
awk 'BEGIN {f=10;l=f+1949;}{if(NR<=l && NR>=f) print >(f"_"l".txt"); else
if(NR>l) f=l+10;l=f+1949;}' < inputfile.txt
说明:
1. 要被切割的是 inputfile.txt
2. 新产生的 outputfiles will take the format of .txt,
for example, 10_1959.txt,1969_3918.txt,3928_5877.txt and so on... |
|
R****a 发帖数: 199 | 6 depends on your setting, but you can try the following:
in shell, use the command,
mysql --database=$dbname -p$pswd -e "$yourquer" > $outputfile
Then you try to send this output file to a mail recipient. |
|
l*******G 发帖数: 1191 | 7 试试
sed -e 's/\/-//' inputfile > outputfile |
|
s*******f 发帖数: 757 | 8 I have data files with format like this:
year,mon,day,data.....
All are numbers and are seperated by coma. Can someone give me some suggestion
how I can use grep to extract the data at certain month, say, March-May.
I tried :
grep "^[[:digit:]\{\4\}[, ][3-5]]" inputfile >outputfile
It doesn't work.
Thanks!!! |
|
a**n 发帖数: 313 | 9 awk -F, '{if($2==4 || $2==5) print}' inputfile > outputfile |
|
d******e 发帖数: 2265 | 10 subprocess, redirect is kind of tricky and hard.
search subprocess redict will give you lots of hints.
I personally like the
with blah as blah:
call(blahlist, outputfile= blah)
way |
|
n*****d 发帖数: 956 | 11 Linux下有adobe?
手动ps2pdf: ps2pdf (or ps2pdf14) -sPAPERSIZE=a4 inputfile.ps outputfile.pdf
具体的paper size定义看一看文档吧.man ps2pdf |
|
h*********2 发帖数: 192 | 12 set output OUTPUTFILE
plot INPUTFILE u 1:COL ps 0 lw 3 lc rgb "red" ti "M",
INPUTFILE2 u 1:COL ps 0 lw 3 lc rgb "purple" ti "L^{+}",
INPUTFILE3 u 1:COL ps 0 lw 3 lc rgb "blue" ti "P"
请问这个第三行 的符号 "L^{+}" 为啥出不来呢?
问下,谢谢~ |
|
A**u 发帖数: 2087 | 13 tell him ya......
awk 'NR>line#1 && NR outputfile
I suppose you want to print contents between line#1 to line#2. |
|
r*****s 发帖数: 985 | 14 with enscript:
% enscript -a odd(or even) -o outputfile.ps inputfile.name |
|
i********e 发帖数: 16 | 15
Use copy file1+file2+file3+... outputfile |
|
D*******a 发帖数: 207 | 16 最简单的是用tr;置换成空格:
tr "\t" " " inputfile > outputfile |
|