由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - A question for highhands..
相关主题
请教:Variable in sed commandhow to turn off sendmail
Perl help: open a very large filehow to print ' in awk and sed.
[转载] Hidden character in a filehow to block junk mail in unix?
bsplit.chotkey in unix
help!!I want to install mrouted for solaris-i386!Perl: conditionally match multiple lines
HELP: How to get rid of unwanted characters in file namesed question??
Re: HELP: How to get rid of unwanted characters in file name数组大小问题请教
How to monitor peak memory usage?AWK problem, SOS!
相关话题的讨论汇总
话题: junk话题: matrix话题: begining话题: highhands话题: file
进入Unix版参与讨论
1 (共1页)
z**w
发帖数: 69
1
I have a txt file containing a matrix that I need. But there
are 15 lines of unwanted text at the begining, also some unwanted
text to the right of the matrix.
for example the file may look like this:
(Begining of file)
junk junk junk ............
.... (15 line of junk)
junk junk junk ............
0 0 1 2 3 4 5
2 3 5 2 2 3 4 junk
......
......
......
3 3 4 2 4 2 3
(End of file)
How do I get rid of texts of the begining 15 lines
and the texts on the right, leaving only the matrix in a
D**e
发帖数: 10169
2
if you know the dimension of the matrix, it's easy. suppose it's MxN. and M/N
is not too large.
tail -n M infile | awk '{printf "%d %d ... %d\n", $1, $2, ..., $n}' > outfile

【在 z**w 的大作中提到】
: I have a txt file containing a matrix that I need. But there
: are 15 lines of unwanted text at the begining, also some unwanted
: text to the right of the matrix.
: for example the file may look like this:
: (Begining of file)
: junk junk junk ............
: .... (15 line of junk)
: junk junk junk ............
: 0 0 1 2 3 4 5
: 2 3 5 2 2 3 4 junk

z**w
发帖数: 69
3
the number of columns of the matrix is not constant.
how can I retrieve this number from "wc -l"?
or is there any options of "tail" to take the all the contents starting
from line 16?
thanks..

M/N
outfile

【在 D**e 的大作中提到】
: if you know the dimension of the matrix, it's easy. suppose it's MxN. and M/N
: is not too large.
: tail -n M infile | awk '{printf "%d %d ... %d\n", $1, $2, ..., $n}' > outfile

1 (共1页)
进入Unix版参与讨论
相关主题
AWK problem, SOS!help!!I want to install mrouted for solaris-i386!
[转载] command to save outputHELP: How to get rid of unwanted characters in file name
请问几个关于Sed的问题Re: HELP: How to get rid of unwanted characters in file name
awk question, looking for helpHow to monitor peak memory usage?
请教:Variable in sed commandhow to turn off sendmail
Perl help: open a very large filehow to print ' in awk and sed.
[转载] Hidden character in a filehow to block junk mail in unix?
bsplit.chotkey in unix
相关话题的讨论汇总
话题: junk话题: matrix话题: begining话题: highhands话题: file