由买买提看人间百态

topics

全部话题 - 话题: file1
首页 上页 1 2 3 4 下页 末页 (共4页)
c***r
发帖数: 4631
1
来自主题: Java版 - Java的中文读写问题
It works for me. Did you installed a Chinese version of JDK?


我要从一个纯文本文件file1.txt中将某些汉字逐个读出,并逐个写入文件file2.txt中
w*********y
发帖数: 28
2
来自主题: Java版 - One simple question!
Hello!
I want to use multiple data files as input. But, it may be very boring by
input like:

java class1 file1.dat file2.dat ......filen.dat (LONG LIST!!!)
Is it possible to input like : java class1 file*.dat
C++ can do it. How can Java?
Thanks a lot!


A******a
发帖数: 61
3
Process p = Runtime.getRuntime("cat /users/test/file1.txt /users/test/file2.
txt > /users/test/file3.txt").exec;
It reports an error like this:
cat: /users/test/file3.txt: No such file or directory
it seems it is the redirecting ">" symbol makes problem.
can anyone help here?! thanks.
l****3
发帖数: 8
4
来自主题: Java版 - java EL 问题请教
I think the easist way is to creat a colletion, either array or list,for
example, filelist to store your all variables, file1...file10, and then use


.....
make sure to save filelist as attribute to any of EL implicit object so EL can access it.
b****t
发帖数: 114
5
Hi all,
I want to append new column data to a data file. The data has been formated
in a tabbed way (very clean data without any missing/empty cells). This is
usefull when I run my c/c++ code and save data each time as one or more
columns. Ideally, it will be done within c/c++ code with fstream, but it is
ok to use stript split single (or 2 column) column data into multiple
columns.
e.g.
file1:
1 2 3
2 3 4
5 6 7
x****s
发帖数: 921
6
when you have the time, why not try out yourself?
dd if=/dev/zero of=/mnt/file1 bs=1M count=800
a******k
发帖数: 1190
7
来自主题: Linux版 - [请教]文件输入 (转载)
yes, it takes a command option to read file, like:
exe -i file1 -j file2 -other options
is it possible to call it without file in perl?
J*******i
发帖数: 2162
8
cp -r /user/file1/* /user/file2/
x*g
发帖数: 689
9
来自主题: Linux版 - gvim diff question
【 以下文字转载自 Programming 讨论区 】
发信人: xig (xig), 信区: Programming
标 题: gvim diff question
发信站: BBS 未名空间站 (Wed Aug 12 11:43:48 2009, 美东)
我用gvim -d file1 file2来比较文件(windows下面),但是我怎么跳到下个
difference的地方? google一下说用 [c 和 ]c, 我试了试,光标没有跳到下个
difference。 谢谢!
t*****g
发帖数: 1275
10
diff file1 file2 | grep '^>' | sed 's/^> //'
b*****d
发帖数: 24
11
我有很多个(几百个)文本文件file1,file2,...filem,每个文件中都有100个这样的
字符串,'step n',n是一个占用8个字符的整数,具体数值不确定,该字符串在所在行
的开头。
我现在需要做这样处理,把文件filem中的每个'step n' 字符串的数字n都替换为数字n
+m*100。我想写shell script来完成,不知道怎么实现,请高手指教。我试了:
sed 's/^step\(.\{8\}\)/step$(\1+500)'
但是不起作用。关键是我只不知道怎么把\1得到的字符串转化为整数,在做计算,不知
道sed有没有这样的功能。
Thx!
a*****8
发帖数: 261
12
来自主题: Linux版 - 怎么实现这个alias
hi
我现在需要写个alias under tcsh:
alias emac emacsclient
然后每次从terminal我输入:
linux>emac file1.txt &
就是用emac 打开文件file.txt 并且在背后运行(所有有个 &)
请问,有没有alias 的写法,能够把这个& sign 也加进去?谢谢
r*****r
发帖数: 397
13
I have a directory with hundreds of *.doc files,and I want to search a word "t
otal", if the total value is greater than 50, then I want to copy this file to
a new directory,and change the name sequentially to file001.doc,file002.doc .
...sth like that.
So, when I grep "total" ,I got
file1.doc
total: 12
file2.doc
total: 13
file3.doc
total: 56
...
#! /bin/tcsh
foreach wordfile (*.doc)
grep total $wordfile | awk '($2 > 50) {com = sprintf("cp " $wordfile "
../new_dir");print c
w******g
发帖数: 82
14
来自主题: Programming版 - 求助:script for commands (转载)
【 以下文字转载自 Linux 讨论区 】
发信人: wenxiang ( ), 信区: Linux
标 题: 求助:script for commands
发信站: BBS 未名空间站 (Tue Jul 10 09:28:07 2007)
最近在run一个ns2 based的simulation.我写了一个外挂的matlab程序产生scenario和
分析数据.所输入命令大概是这样的
nohup matlab /dev/null
ns file.tcl
awk -f handle_trace.awk output_trace.tr > extracted_trace.txt
nohup matlab /dev/null
为了完成和分析一次simulation,我需要依次输入上面几个命令。我现在想一次run上
100次simulation。请问有没有办法写个script什么的,让unix/linux系统顺次运行这
些命令100遍。如果可以,大概是什么样的?谢谢!
G*P
发帖数: 42
15
来自主题: Programming版 - Path with non-ascii character
OS 是 English Windows, 假如文件的路径有non-ascii,例如中文, c:\tmp\文件\file1
.txt.
用C或C++能实现对该文件的搜索,打开吗?
fopen does not work for sure. would _wfopen() work?
what if the OS is Chinese windows? how to program it in c or C++?
c***d
发帖数: 996
16
☆─────────────────────────────────────☆
bruklyn (我爱布鲁克林) 于 (Sun Jul 29 23:38:09 2007) 提到:
比如
file1.cpp
class A{
int data;
};
file2.cpp
class A{
char data;
};
在vc++8.0上,编译链接没有问题通过了。运行也不报错。
☆─────────────────────────────────────☆
thrust (Thrust Jaeina) 于 (Mon Jul 30 01:23:49 2007) 提到:
不可以的.
不过,根据standard,编译器似乎没有义务提醒你这件事,不过这里用语不是太明白,我吃
不太准.

☆─────────────────────────────────────☆
hypo (三十未满) 于 (Mon Jul 30 04:30:16 2007) 提到:
你 A a; 过?
☆─────────────────────────────────────☆
dArtag
b***y
发帖数: 2799
17
☆─────────────────────────────────────☆
shuo (说说罢了) 于 (Thu Sep 22 16:28:10 2005) 提到:
其实是很简单的问题。 两个file,一个file有 node1 node2 C 三个field。另一个
file是个lookup table有 node E F三个field。输出是, node1 node2 C E(node1
) F(node1) E(node2) F(node2). 就是为node1,2找对应的E, F然后全部输出的意思
。 可是我不太会写程序,只能写最简单最笨的。 所以我写乐下边这个。 都还没管node2
, 想着先把node1 得E,F输出出来到一个out.txt里边,然后在运行一遍给node2找对应的E
, F。可是因为我的file1很大,几十万条record。 这个程序运行了2个小时乐,才1/5多
点。 可能也是file I/O的问题。 可是如果我不开关file2, 我不知道怎么让file2的
ifstream指针回到文件最顶上。 结果就是他只查找一遍,然
x*g
发帖数: 689
18
来自主题: Programming版 - gvim diff question
我用gvim -d file1 file2来比较文件(windows下面),但是我怎么跳到下个
difference的地方? google一下说用 [c 和 ]c, 我试了试,光标没有跳到下个
difference。 谢谢!
b**u
发帖数: 1206
19
来自主题: Programming版 - how to assign new value to loop variables?
malloc ptr1 for file1, malloc ptr2 for file2,...
link list for ptr1, ptr2,...
a****l
发帖数: 8211
20
我现在有一堆的C程序,需要知道其中宏定义的数值.比如:
file1: #define pig 1
file2: #define sheep 2
file3: #define dog 5
file4: #define total dog+sheep-pig
需要用一个比如perl的脚本程序扫描过所有的文件,然后能输出total=6.问题是显然这
个计算的方法不是固定的,所以脚本程序基本上需要按照C的规定展开宏定义,找到各词
语对应的数值,再计算出最终的数字.
有谁知道perl能不能做这样的工作?如果不是perl,有什么东西能做这样的事?谢谢!
s*****c
发帖数: 753
21
My data look like this
opt.test.xxx.data=some data
opt.test.xxx.dim.x=some data
opt.test.xxx.dim.y=some data
opt.test.xxx.dim.z=some data
opt.test.xxx.length=some data
opt.test.xxx.tree=some data
I already use grep to extract those lines from a file to a new file using
grep '\.roi\.' file1 > file2
I suppose I will use s/(? something like [data|dim\.x|...] to look ahead?
a***y
发帖数: 2803
22
opt.test.xxx.data=some data
opt.test.xxx.dim.x=some data
opt.test.xxx.dim.y=some data
opt.test.xxx.dim.z=some data
opt.test.xxx.length=some data
opt.test.xxx.tree=some data
用了
grep '\.roi\.' file1 > file2 之后,在file2里面不就只剩下
test.xxx
test.xxx.dim
了吗?
w******p
发帖数: 166
23
来自主题: Programming版 - Perl:如何处理这种hash 结构,
$ cat file1 file 2 | perl -ne '@a=split; if(scalar @a==3){$h{$a[2]}{$a[1]}{$
a[0]}=[]; $h1{$a[0]}=[@a[2,1]]} else {if(exists $h1{$a[0]}){($p,$a)=@{$h1{$a
[0]}}; push @{$h{$p}{$a}{$a[0]}}, $a[1] }else{warn "no entry for found for $
_"}} END{use Data::Dumper; print Dumper(\%h)}'
$VAR1 = {
'P5' => {
'E' => {
'06' => [
'100',
'200',
... 阅读全帖
s****n
发帖数: 150
24
来自主题: Programming版 - 问一个vim的问题
vimdiff file1.txt file2.txt
r**u
发帖数: 1567
25
来自主题: Programming版 - static initialization dependency c++
Thanks.
I tried the following code.
File1.c
int x = 1;
File2.c
#include
extern int x;
int y = x + 1;
int main() {
printf("x: %d y: %d\n", x, y);
}
If compile with gcc, it gives an error "initializer element is not constant"
. But it compile with g++. I guess in C it's not allow to initialize a
global variable from another variable. So no dependency problem in C.

file
a*****8
发帖数: 261
26
来自主题: Programming版 - 怎么实现这个alias (转载)
【 以下文字转载自 Linux 讨论区 】
发信人: apollo8 (apollo8), 信区: Linux
标 题: 怎么实现这个alias
发信站: BBS 未名空间站 (Tue Dec 3 21:10:56 2013, 美东)
hi
我现在需要写个alias under tcsh:
alias emac emacsclient
然后每次从terminal我输入:
linux>emac file1.txt &
就是用emac 打开文件file.txt 并且在背后运行(所有有个 &)
请问,有没有alias 的写法,能够把这个& sign 也加进去?谢谢
t***q
发帖数: 418
27
Later on I found out, in my script, I used difflib.SequenceMatcher to do the
calculations. My friend used Levenshtein that algorithm which is faster.
I used Levenshtein in my script too, later, it runs faster too.
So maybe, two algorithms , one single calculation maybe 0.01 ms difference,
but times 400M, the time difference will be big.
The code:
import csv
import re
import difflib
import operator
import Levenshtein
a=[]
with open("/Users/file1.csv","rb") as f:
reader=csv.reader(f)
f... 阅读全帖
t***q
发帖数: 418
28
My friend's code in R:
da1=read.csv(paste(filepath,"file1.csv",sep=""))
da2=read.csv(paste(filepath,"file2.csv",sep=""))
da1 <- t(da1)
da1 <- as.vector(da1)
da2 <- t(da2)
da2 <- as.vector(da2)
info <- matrix(NA,nrow=length(da1),ncol=40)
position <- 1:length(da2)
for(i in 1:length(da1))
{
a=levenshteinSim(da1[i],da2)
pos=position[a==max(a)]
temp=c(i,pos,max(a),da1[i],da2[pos])
info[i,1:length(temp)] <- temp
if(i %% 500 ==0)
cat("#")
}
l******9
发帖数: 579
29
【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: Truncation error import csv file to SQL table
发信站: BBS 未名空间站 (Wed Apr 29 15:28:46 2015, 美东)
I would like to import a .csv file into a SQL Server 2008R2 database table
on Win 7.
It has one column and one row.
File1:
name
runeocnu 430274 sjunosnv djduenvop 934m ljfonm3
I got error:
Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data
conversion for column "NAME" returned status value 4 and status text "Text
w... 阅读全帖
a*****e
发帖数: 216
30
这两天在研究python command arguments, 有一个python command line script 要执
行多种运算,如 script1.py file1 union file2, script1.py size file3
这里union 是运算,合并两个文件,size 是求file3 的行数.
一个script1.py 可以完成这些运算,而且运算有许多,10来个.
这里的arguments 是positional arguments 吧?但是union, size 又是不一般的
arguments. 那么这种arguments 可以当optional argument 来处理吗?像这个文章里
的"--sum".
http://python.usyiyi.cn/python_278/library/argparse.html
这里还有一个文章:
https://docs.python.org.tw/3/howto/argparse.html
如果union , size 不能当optional argument 来处理,又要怎样处理呢?
这里有关于python... 阅读全帖
z*******w
发帖数: 79
31
I suppose your file is some movie file, and more specifically
.avi file.
You can use VirutalDub to split it into 2 files according to
the frame number.
for example: the original file is from frame 0-1211879
save frame 0-1000000 as file1
save frame 1000000-1211879 as file2
t*r
发帖数: 20
32

use command FC
c:\>FC file1 file2
m*******s
发帖数: 22
33
Hello everyone,
I have some data files which were originally written with a big_endian
machine.
Now, I try to use a fortran routine to read them with the compiler of
gfortran
built in a little_endian linux system. The input line is as follows:
open(8,file='file1' // cdat,
. form='unformatted',convert='big_endian',
. status='old',access='direct',recl=im*jm*4)
Where cdat is a string, say 198101.
When I compile the routine with gfortran, the system tip is: syntax error,
co
c*******o
发帖数: 1722
34
来自主题: Software版 - ftp 问题
【 以下文字转载自 Linux 讨论区 】
发信人: cocojumbo (Nick), 信区: Linux
标 题: ftp 问题
发信站: BBS 未名空间站 (Tue Jul 1 10:29:20 2008), 转信
if i have lists of files/path in a file, how do i download
all of them once and rename them?
for example, in FileName.txt, i have
filepath1/file1.htm
filepath2/file2.htm
.................
filepath1000/file1000.htm
i want to download all 1000 files in FileName.txt. how should
i do this? i also want to rename each file too.
thanks.
c*******o
发帖数: 1722
35
来自主题: Software版 - ftp 问题
say for file1.htm, change to file1_2008_7_1.htm
thx
g*********r
发帖数: 124
36
直接用
\bibliography{file1.bib, file2.bib ,file3.bib}
就可以了
n******h
发帖数: 97
37
你是说在tex文件里面用\bibliography{file1.bib, file2.bib ,file3.bib}么?
这样的话我必须把需要用得reference所有的bib文件名都记住。
主要是我想偷懒,每篇文章只要\bibliography{allreference.bib}就可以了。
然后再allreference.bib去引用不同的bib文件。这样我的bib库变化的话我
只用更新allreference就行乐。
P***i
发帖数: 118
38
来自主题: Unix版 - 请诊断:
我有一台磁带机, 有次操作出现以下错误信息, 请问是何原因, 并请教解决方法, 多谢!
1. mt status
>
> SCSI 2 tape drive:
> File number=0, block number=0, partition=0.
> Tape block size 0 bytes. Density code 0x26 (unknown to this mt).
> Soft error count since last status=0
> General status bits on (41010000):
> BOT ONLINE IM_REP_EN
>
> 2. mt rewind
> (No result)
>
> 3. tar tv
> -rw-r--r-- eeg/users 11447200 2000-06-27 12:46:40 file/file1
> tar: Unexpected EOF on archive file
> tar: Error is not recoverable: exiting now
后来我又试用:
data> m
c******r
发帖数: 38
39

paste file1 file2 > file3 ?
q***e
发帖数: 90
40
来自主题: Unix版 - 请教怎样使用tar压文件
Just type "man tar", that all you nee
to do. If you are really lazy, just ask one
of your fellow to read the manual and do it
for you. It takes only a few minutes. A simple
command might be:
tar cvf name.tar file1 files2 ...
Where files1 , file2 is the file/directory name
you want to tar. EVerything could be found from teh
manual.
m*****e
发帖数: 4193
41

file2=`echo $file1 | sed s/a/xyz/g`
w*****n
发帖数: 94
42
copy in dos can do that.
copy /b file1 + file2 file3
o**a
发帖数: 86
43

sth like this:
for i in `sort -u file1.txt` #the small dot here is backquote
do
j=`echo $j $i`
done
echo $j
i***e
发帖数: 3219
44
来自主题: Unix版 - compare which file is newer
i mean file1 and file2 are in different machines.
b*********l
发帖数: 30
45
来自主题: Unix版 - compare which file is newer
ls -t -l file1; rsh ls -t -l file2
o******l
发帖数: 828
46
A guy sent me a tar file, but he tar those files with absolute path;
for example, I got below when using tar tvf thetarfile.tar:
-rw-r--r-- 3433 Oct 17 10:06 2002 /home/dude/file1.cpp
-rw-r--r-- 1007 Oct 17 10:06 2002 /home/dude/file2.cpp
-rw-r--r-- 8235 Oct 17 10:06 2002 /home/dude/file3.cpp
Is it possible for me to extract by tar? Since the guy used absolute path,
"tar xvf..." can't succeed as I have no permission to create directories under
home. Is there a workaround? Thanks.
c**o
发帖数: 166
47
来自主题: Unix版 - Remove core.xxxx files?
-o looks like a good option. But it seems that it is not working although the
manual page says that it should work.
I tried
find . -name file1 -o -name file2 -print
on Solaris 8 and Redhat 8.0, it only listed files2.
Am I missing anything here?
Thanks,

I
s**s
发帖数: 242
48
来自主题: Unix版 - Remove core.xxxx files?
sorry! should be:
find / \( -name file1 -o -name file2 \) -ls
首页 上页 1 2 3 4 下页 末页 (共4页)