delete file without opening vi


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers delete file without opening vi
# 8  
Old 01-25-2006
num=`wc -l filename`
deleten=x
##where x is number of lines you want to delete
(( t = $num - $deleten ))
## this gives total lines in file

tail -$t filename > newfilename
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to read a file without opening the file and delete last line?

I have file called "text". The contents are as below : aaa bbb ccc ddd eee ffff ddd hhhh iiii I want to read this file without opening and and delete the last line. How can it be done? (4 Replies)
Discussion started by: the_hunter
4 Replies

2. Shell Programming and Scripting

Opening a file in vi and automatically save and quit this file using shell script

Hi friends, In my shell script, I want to open a file using vi editor. After opening the file in vi, I want to save and quit this file automatically.... all through shell script. the code segment is: ------------------------------------------------------------ cd ~/netfpga/projects/scone/sw/... (2 Replies)
Discussion started by: sachinteotia
2 Replies

3. Shell Programming and Scripting

Xmllint - Xml-file problem --ods file not opening

Dear All, this is my first post on this Forum, glad to be here. I'm trying to fix an .ods file. Yes, I had a backup, but it's also corrupted. When opening the document I get this EM: read error format error discovered in the file in sub-document content.xml at 2,337040(row,col). So I... (3 Replies)
Discussion started by: jameslast
3 Replies

4. Shell Programming and Scripting

How to Delete string without opening a file

Hi Experts, I have several big size file arround 900 MB. From the file I need to delete some common strings but without opening the file. here is example- in file <?xml version='1.0' encoding='ISO-8859-1' standalone='no'?> <LogItems> <log logid="8423b5ae190810252359350480/1/1/1"> ... (6 Replies)
Discussion started by: thepurple
6 Replies

5. UNIX for Dummies Questions & Answers

Urgent help needed to delete some text without opening the file in unix

Hi To delete some text in 2 files in line1 ( not complete line) in unix without opening the files. For example: source file is like this <?xml version="1.0"... (5 Replies)
Discussion started by: pyaranoid
5 Replies

6. Shell Programming and Scripting

How to delete a particular text without opening the file.

Hi, Could someone tell me how to delete a particular text inside an existing file without opening the file? e.g. I have a text file called mytext.txt which contains three lines of text below and I want to delete “ ;” and delete the second line “b ;” including the carriage return. a ; b ; c ;... (12 Replies)
Discussion started by: stevefox
12 Replies

7. Shell Programming and Scripting

Deleting lines inside a file without opening the file

Hi, Just consider there are around 10 lines in a file. Now is it possible to delete the first 2 lines in the file without opening the file. No matter whatever the content of the file is, I just wanna delete the first 2 lines without opening the file. Is that possible? If so, please help me out.... (3 Replies)
Discussion started by: toms
3 Replies

8. Shell Programming and Scripting

how to know whether that file has eol or noeol before opening that file in VI editor

Hi, I want to check whether file has EOL or NOEOL before opening this file in VI editor. My file is very big its in terms of 15-20 MB. I am using ksh for this. When we opened the file in vi editor, normally at last line we are able to see whether this is eol or noeol file. But i does want... (1 Reply)
Discussion started by: HariRaju
1 Replies

9. Shell Programming and Scripting

Making Changes without opening file

Hello, I'm new to scripting, I have a file test.dat. I want to make changes to it with out openning it. Example: test.dat has rows, and I want to change value "LA" to "TX" without opening it or without writing it to another file. Is it possible? Thanks (9 Replies)
Discussion started by: irehman
9 Replies

10. UNIX for Dummies Questions & Answers

opening a file

im trying to open a file in my bin directory and the farthest i can get is into the folder but not the actual file itself i use text edit as the editor. when i try to open the file it says it doesn't exist here is what i type cd bin open cmnds (dir. which it is under) open test no such... (4 Replies)
Discussion started by: hiei
4 Replies
Login or Register to Ask a Question
tapset::nfsd(3stap)													       tapset::nfsd(3stap)

NAME
tapset::nfsd - systemtap nfsd tapset DESCRIPTION
nfsd.dispatch NFS server receives an operation from client See probe::nfsd.dispatch(3stap) for details. nfsd.proc.lookup NFS server opening or searching for a file for client See probe::nfsd.proc.lookup(3stap) for details. nfsd.proc.read NFS server reading file for client See probe::nfsd.proc.read(3stap) for details. nfsd.proc.write NFS server writing data to file for client See probe::nfsd.proc.write(3stap) for details. nfsd.proc.commit NFS server performing a commit operation for client See probe::nfsd.proc.commit(3stap) for details. nfsd.proc.create NFS server creating a file for client See probe::nfsd.proc.create(3stap) for details. nfsd.proc.remove NFS server removing a file for client See probe::nfsd.proc.remove(3stap) for details. nfsd.proc.rename NFS Server renaming a file for client See probe::nfsd.proc.rename(3stap) for details. nfsd.open NFS server opening a file for client See probe::nfsd.open(3stap) for details. nfsd.close NFS server closing a file for client See probe::nfsd.close(3stap) for details. nfsd.read NFS server reading data from a file for client See probe::nfsd.read(3stap) for details. nfsd.write NFS server writing data to a file for client See probe::nfsd.write(3stap) for details. nfsd.commit NFS server committing all pending writes to stable storage See probe::nfsd.commit(3stap) for details. nfsd.lookup NFS server opening or searching file for a file for client See probe::nfsd.lookup(3stap) for details. nfsd.create NFS server creating a file(regular,dir,device,fifo) for client See probe::nfsd.create(3stap) for details. nfsd.createv3 NFS server creating a regular file or set file attributes for client See probe::nfsd.createv3(3stap) for details. nfsd.unlink NFS server removing a file or a directory for client See probe::nfsd.unlink(3stap) for details. SEE ALSO
probe::nfsd.dispatch(3stap), probe::nfsd.proc.lookup(3stap), probe::nfsd.proc.read(3stap), probe::nfsd.proc.write(3stap), probe::nfsd.proc.commit(3stap), probe::nfsd.proc.create(3stap), probe::nfsd.proc.remove(3stap), probe::nfsd.proc.rename(3stap), probe::nfsd.open(3stap), probe::nfsd.close(3stap), probe::nfsd.read(3stap), probe::nfsd.write(3stap), probe::nfsd.commit(3stap), probe::nfsd.lookup(3stap), probe::nfsd.create(3stap), probe::nfsd.createv3(3stap), probe::nfsd.unlink(3stap), probe::nfsd.rename(3stap), stap(1), stapprobes(3stap) IBM
--- tapset::nfsd(3stap)