这里要求将职位9-12改为空白,例如,在所有固定规模的记录中。
I 旧
cat file | awk {sub(substr($0,9,12)," ",$0);print}
工作,除非职位上有一个空白 9. 要求指出这种限制。
cat file | awk -F"*" {sub(substr($0,9,12)," ",$0);print}
无帮助。 这里的右yn是什么?
这里要求将职位9-12改为空白,例如,在所有固定规模的记录中。
I 旧
cat file | awk {sub(substr($0,9,12)," ",$0);print}
工作,除非职位上有一个空白 9. 要求指出这种限制。
cat file | awk -F"*" {sub(substr($0,9,12)," ",$0);print}
无帮助。 这里的右yn是什么?
Sample file:
$ cat file
1234567890123456
1234567 90123456
1234567890123456
1234567 90123456
1234567890123456
1 D-1, 1 D-1, 1 D-1, 1 D-1, 1 P-5, 1 P-4, 1 P-3, 1 P-2, 1 GS 想法:
awk { print substr($0,1,8) " " substr($0,13) } file
<>0>NOTES:
" "
with " "
这产生了:
12345678 3456
1234567 3456
12345678 3456
1234567 3456
12345678 3456
利用同一想法积极处理这些立场(在评论中类似于Cyrus建议):
awk -v start=9 -v end=12 { print substr($0,1,start-1) sprintf("%*s",(end-start+1)," ") substr($0,end+1) } file
这也产生了:
12345678 3456
1234567 3456
12345678 3456
1234567 3456
12345678 3456
利用GNU AWK
$ awk -v from=9 -v to=12 BEGIN{FS=OFS=""}{for(i=from;i<=to;i++) $i=" "}1 file
How can I split a large text file into separate files by character count using PHP? So a 10,000 character file split every 1000 characters would be split into 10 files. Further, can I split only after ...
Does anybody know an open-sourcefree library that does term clustering? Thanks, yaniv
I ve written a Ruby script that is reading a file (File.read()) that contains unicode characters, and it works fine from the command line. However, when I try to put it into an Automator Workflow (...
do you know about an effective method for extracting key sentences from a text with their frequency parameters, etc and that can also do "stemming" (search also for similar sentences) ? I wonder also ...
I want to edit the following text so that every line begins with Dealer:. This means no wrapping/line breaks. For lines starting with System, wrapping is fine. What would a solution in ruby look like?...
I ve got a huge file (500 MB) that is organized like this: <link type="1-1" xtargets="1;1"> <s1>bunch of text here</s1> <s2>some more here</s2> </link> <...
I need to find word count for all of the files within a folder. Here is the code I ve come up with so far: $f="../mts/sites/default/files/test.doc"; // count words $numWords = str_word_count($str)/...
is it possible in Python, given a file with 10000 lines, where all of them have this structure: 1, 2, xvfrt ert5a fsfs4 df f fdfd56 , 234 or similar, to read the whole string, and then to ...