I've got some problem, I have list of data in the file:
053-37878 03828008 Moskovitch James 500
052-34363 01234567 Mendelson Kippi 450
053-32322 03828008 Jameson Shula 350
054-39238 03333333 Merden Moshe 300
is it poss开发者_开发问答ible rewrite this list in the same file (without using temporary file) but without last number thanks in advance for any help (I'm talking about C-Shell scripts)
Why do you need to avoid temporary files?
cut -d " " -f 1,2,3 myfile > myfile2; mv myfile2 myfile
You can also easily use Perl's
-i
switch to edit the file in place. It still creates a temp file under the covers, IIRC.If you need this for homework, use Perl to read the file into memory (File::Slurp), chop off last field using regex or somesuch; and write over the file from entire stored data using another File::Slurp
精彩评论