delete file without opening vi


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers delete file without opening vi
# 1  
Old 01-25-2006
Bug delete file without opening vi

hi there guys,

wonder if any gurus can help me out on this one...

try searching the past threads but cant find anything.

i have this huge file but when i use vi to open it it gives me the following error:

<"pmrepserver.txt""/var/tmp/Ex86200" There is not enough space in the file system.>

i know there is a command to delete the line but i have somehow forgot...can anyone give me a clue?

btw im using aix.

many thanks.



wee
# 2  
Old 01-25-2006
Do you just want to delete the file or a line within the file?
# 3  
Old 01-25-2006
i wan to delete a few lines in the upper part of the file but i dont think i can even edit any.
# 4  
Old 01-25-2006
Try to copy the file to a windows PC using FTP. Open the file in wordpad or something similar and Windows should open the file which will allow you to delete the lines you want taken out.
Once completed ftp the file back to the unix server.

Yes, there are command to do this within AIX but I can't remember of the top of my head either.

Hope it helps?
Mark
# 5  
Old 01-25-2006
hi there,

thanks for the solution but it took a whole lot of time to ftp the file over (rather huge file) which is why im asking if anyone can give me a headstart somewhere....
# 6  
Old 01-25-2006
this will delete lines from the file,

Code:
sed '1,10d' filename > redirect_output_tofile_othermountpoint

# 7  
Old 01-25-2006
Hi u can do it this way as well


ex file_name
:1,5d (specify the range of lines to delete)
:wq!

for example

[/gaurav]$cat tt.dat
919414247059/1026490612/123
919414315787/1353677423/123
919414951631/1026490612/123
919414315787/1601060933/123

[/gaurav]$ex tt.dat
"tt.dat" 5 lines, 113 characters
:1,2d
919414951631/1026490612/123
:wq
"tt.dat" 3 lines, 57 characters

[/gaurav]$cat tt.dat
919414951631/1026490612/123
919414315787/1601060933/123

as you can see the first two lines are deleted

cheers,
Gaurav
 
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