Sponsored Content
Special Forums UNIX Desktop Questions & Answers Deleting Junks at the end of each line in a file Post 302138974 by dave_nithis on Thursday 4th of October 2007 03:10:30 AM
Old 10-04-2007
Single line Script - You can use any commands but i dont want for loop,if loop,while loop etc.,I want a simple script.

Record - Am calling Each line in a file as record

Junk - As I said unwanted characters including backslash

Ex:
"401","1G1AL55F377159935 ",30482,"MD","3","09/17/2007",9000 -Valid record
"401","1G1AL55F377159935 ",30482,"MD","3","09/17/2007",9000[ - invalid
"401","1G1AL55F377159935 ",30482,"MD","3","09/17/2007",9000; - invalid
"401","1G1ZT58N47F140841 ",29098,"MD","3","09/17/2007",10600'" - invalid
"401","1G1ZT68N57F138781 ",27403,"GA","1","09/17/2007",10100' - invalid
"401","1G4HD57227U217222 ",7163,"MI","3","09/17/2007",21600: - invalid

You can certainly use awk or sed!!
Thanks!Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Deleting UNIX End of Line Chachracter \000

Hi, I have this file which has some octal NULL characters (\000). I need to replace these characters with an ASCII NULL. I've tried using Perl, the UNIX tr command.. History of this I received a COBOL generated file, ran the od command to convert to a xxx byte per record file. Now,... (3 Replies)
Discussion started by: uchachra
3 Replies

2. Shell Programming and Scripting

Deleting end line spaces for along file

How can i clear all space characteres for a long file at the end of each line? (3 Replies)
Discussion started by: osymad
3 Replies

3. UNIX for Advanced & Expert Users

Deleting end of line $ character in file

Hi, I've got a file where in the middle of the record is a $ end of line character, visible only when I open the file in vi and do :set list. How to I get rid of the character in the middle and keep it at the end. The middle $ character always appears after SW, so that can be used to tag it.... (3 Replies)
Discussion started by: bwrynz1
3 Replies

4. UNIX for Dummies Questions & Answers

deleting word from this point to end of file in VI

Hi All i need to delete a recurring word from point "n" till end of the file. there are other words in this file so i cannot use `dG`, can anyone help me out? Kind regards Brian (4 Replies)
Discussion started by: brian112
4 Replies

5. Shell Programming and Scripting

deleting the lines at the end of the file.

I have a text file with two coulmn first column is just used in to show the line number, these line number are not there in the real file. I want to delete the line 16(in this file) here, even tough there is no data inside it . this empty line is causing me a problem by throwing me garbage... (12 Replies)
Discussion started by: shashi792
12 Replies

6. Shell Programming and Scripting

deleting blank lines ONLY at the end of the file

Hi Guys, I have a quetion which was already discussed in the forum, but for some reason all approches suggested fail for me. I have a file which have blank lines at the body of the text as well as at the end. I need to delete ONLY blank lines at the end. Unfortunatly the approach below does not... (5 Replies)
Discussion started by: aoussenko
5 Replies

7. Shell Programming and Scripting

deleting the part of the file(overwrite) using start and end point

here is the contents of bigfile.sql CREATE TABLE `Table11` ( `id` int(11) NOT NULL , `entityName` enum('Lines','EndUsers') COLLATE utf8_unicode_ci NOT NULL, `parentAllianceMigrationProjectId` varchar(255) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=2000 DEFAULT CHARSET=utf8... (30 Replies)
Discussion started by: vivek d r
30 Replies

8. Shell Programming and Scripting

Adding tab/new line at the end of each line of a file

Hello Everyone, I need a help from experts of this community regarding one of the issue that I am facing with shell scripting. My requirement is to append char's at the end of each line of a file. The char that will be appended is variable and will be passed through command line. The... (20 Replies)
Discussion started by: Sourav Das
20 Replies

9. Shell Programming and Scripting

With script bash, read file line per line starting at the end

Hello, I'm works on Ubuntu server My goal : I would like to read file line per line, but i want to started at the end of file. Currently, I use instructions : while read line; do COMMAND done < /var/log/apache2/access.log But, the first line, i don't want this. The file is long... (5 Replies)
Discussion started by: Fuziion
5 Replies

10. Shell Programming and Scripting

Printing string from last field of the nth line of file to start (or end) of each line (awk I think)

My file (the output of an experiment) starts off looking like this, _____________________________________________________________ Subjects incorporated to date: 001 Data file started on machine PKSHS260-05CP ********************************************************************** Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies
ns_return(3aolserver)					    AOLserver Built-In Commands 				     ns_return(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
ns_connsendfp, ns_respond, ns_return, ns_returnadminnotice, ns_returnbadrequest, ns_returnerror, ns_returnfile, ns_returnforbidden, ns_returnfp, ns_returnnotfound, ns_returnnotice, ns_returnredirect, ns_returnunauthorized, ns_write - commands SYNOPSIS
ns_connsendfp fp len ns_respond ns_return status type string ns_returnadminnotice status msg ?longmsg? ns_returnbadrequest reason ns_returnerror status msg ns_returnfile status type filename ns_returnforbidden ns_returnfp status type fileid len ns_returnnotfound ns_returnnotice status msg ?longmsg? ns_returnredirect location ns_returnunauthorized ns_write string _________________________________________________________________ DESCRIPTION
These procedures provide a simple interface for returning information to the client. They build HTTP/1.0 headers and send the appropriate data out the socket to the client. The script does not end at the time ns_return* is invoked so you can continue processing data after the client has gotten the data and closed the socket. type should be a MIME type (see ns_guesstype manual page for a list). status is a three-digit number fitting the pattern below: 1xx Infor- mational - Not used, but reserved for future use. 2xx Success - The action was successfully received, understood, and accepted. 3xx Redi- rection - Further action must be taken in order to complete the request. 4xx Client Error - The request contains bad syntax or cannot be fulfilled. 5xx Server Error - The server failed to fulfill an apparently valid request. Some common status values and their meanings are: 201 Created 202 Accepted 203 Provisional Information 204 No Content 300 Multiple Choices 301 Moved Permanently 302 Moved Temporarily 303 Method 304 Not Modified 401 Unauthorized 402 Payment Required 403 Forbidden 404 Not Found 405 Method Not Allowed 406 None Acceptable 407 Proxy Authentication Required 408 Request Time-out 409 Conflict 410 Gone 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Time-out ns_connsendfp This function writes len bytes of the specified channel or file to the conn. ns_return Sends back both the headers and the string. ns_returnadminnotice Wraps the text msg and longmsg in some html, appends a line with a link to "mailto:serveradministrator" based on the virtual server parameter "WebMaster". ns_returnbadrequest Returns a 400 status code and a formatted HTML message containing the reason text. ns_returnerror Wraps the text msg in some html and returns that to the client. ns_returnfile Sends back the headers and the contents of the file. ns_returnforbidden Returns a 403 status code. ns_returnfp First sends the appropriate headers. Next, it writes out the contents of file from the current file position until the end of the file. ns_returnnotfound Returns a 404 status code. ns_returnnotice Wraps teh text msg and longmsg in some html and returns that to the client. ns_returnredirect Returns a redirect to the passed in location ns_returnunauthorized Returns a 401 status code ns_write Writes the string out the connection. You can use it instead of the ns_return or ns_respond functions to build HTTP responses. AOLserver will not include the usual headers on the output data. The script does not end at the time ns_write* is invoked so you can continue processing data after the client has gotten the data and closed the socket. SEE ALSO
ns_respond(n), ns_writefp(n) KEYWORDS
AOLserver 4.0 ns_return(3aolserver)
All times are GMT -4. The time now is 05:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy