Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to read a file without opening the file and delete last line? Post 302897322 by the_hunter on Sunday 13th of April 2014 07:04:40 AM
Old 04-13-2014
How to read a file without opening the file and delete last line?

I have file called "text". The contents are as below :

Code:
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?

Last edited by Scrutinizer; 04-13-2014 at 05:53 PM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

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... (7 Replies)
Discussion started by: lweegp
7 Replies

2. Shell Programming and Scripting

Urgent help required in deleting a line without opening a file usinga shell script

Hi, I need a help in deleting a line matching a particular pattern in a file using shell script without opening the file. The file is a .c/.cpp file. Is it possible? Thanks (6 Replies)
Discussion started by: naan
6 Replies

3. 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

4. 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

5. 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

6. Shell Programming and Scripting

shell script to read a line in gps receiver log file and append that line to new file

Hi, I have gps receiver log..its giving readings .like below Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GPSD,R=1 $GPGSV,3,1,11,08,16,328,40,11,36,127,00,28,33,283,39,20,11,165,00*71... (3 Replies)
Discussion started by: gudivada213
3 Replies

7. Shell Programming and Scripting

bash: read file line by line (lines have '\0') - not full line has read???

I am using the while-loop to read a file. The file has lines with null-terminated strings (words, actually.) What I have by that reading - just a first word up to '\0'! I need to have whole string up to 'new line' - (LF, 10#10, 16#A) What I am doing wrong? #make file 'grb' with... (6 Replies)
Discussion started by: alex_5161
6 Replies

8. Shell Programming and Scripting

echo ls to a file and then read file and selectively delete

I'm trying to write a script that will do an ls of a location, echo it into a file, and then read that file and selectively delete files/folders, so it would go something like this: cd $CLEAN_LOCN ls >>$TMP_FILE while read LINE do if LINE = $DONTDELETE skip elseif LINE =... (2 Replies)
Discussion started by: MaureenT
2 Replies

9. Shell Programming and Scripting

Read file line by line and process the line to generate another file

Hi, i have file which contains data as below(Only sample shown, it may contain more data similar to the one shown here) i need to read this file line by line and generate an output file like the one below i.e based on N value the number of MSISDNs will vary, if N=1 then the following... (14 Replies)
Discussion started by: aemunathan
14 Replies

10. Solaris

Getting read only propmt when opening /etc/system file

root@atrcx146:/# vi /etc/system "/var/tmp/Exv9a4Rb" Read-only file system Please let me know the reason (1 Reply)
Discussion started by: Marty11
1 Replies
hp-firmware(1)							   User Manuals 						    hp-firmware(1)

NAME
hp-firmware - Firmware Download Utility DESCRIPTION
Download firmware to a device that requires downloaded firmware to function. (Note: Most printers do not require the use of this utility). SYNOPSIS
hp-firmware [DEVICE_URI|PRINTER_NAME] [MODE] [OPTIONS] PRINTER
|DEVICE-URI To specify a device-URI: -d<device-uri> or --device=<device-uri> To specify a CUPS printer: -p<printer> or --printer=<printer> MODE
Run in graphical UI mode: -u or --gui (Default) Run in interactive mode: -i or --interactive Run in non-interactive mode: -n or --non-interactive OPTIONS
Use Qt4: --qt4 (Default) Set the logging level: -l<level> or --logging=<level> <level>: none, info*, error, warn, debug (*default) Run in debug mode: -g (same as option: -ldebug) This help information: -h or --help Use USB IDs to specify printer: -s bbb:ddd, where bbb is the USB bus ID and ddd is the USB device ID. The ':' and all leading zeroes must be present. Seconds to delay before download: -y<secs> or --delay=<secs> (float value, e.g. 0.5) SEE ALSO
hp-plugin hp-toolbox AUTHOR
HPLIP (Hewlett-Packard Linux Imaging and Printing) is an HP developed solution for printing, scanning, and faxing with HP inkjet and laser based printers in Linux. REPORTING BUGS
The HPLIP Launchpad.net site https://launchpad.net/hplip is available to get help, report bugs, make suggestions, discuss the HPLIP project or otherwise contact the HPLIP Team. COPYRIGHT
Copyright (c) 2001-14 Hewlett-Packard Development Company, L.P. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to distribute it under certain conditions. See COPYING file for more details. Linux 2.4 hp-firmware(1)
All times are GMT -4. The time now is 02:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy