02-25-2013
How to Remove comma as last character in end of last line of file?
how to Remove comma as last charector in end of last line of file:
example:
input file
---------------
aaaaaa,
bbbbbb,
cccc,
12345,
____________
output file :
-----------
aaaaaa,
bbbbbb,
cccc,
12345
-----------
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
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
2. UNIX for Dummies Questions & Answers
Hi,
I have a file which has records which end with a comma.
for example:
My file looks like
1234,
5678,
3455,
3566,
4444,
9999,
I need to remove comma for the last line in the file so that my file should look like:
1234,
5678,
3455, (5 Replies)
Discussion started by: sandeep_1105
5 Replies
3. Shell Programming and Scripting
Hi All
I have a file which conatins record.the length of every records is 47.
problem : in the end of record i don't have a "\015" character.
i want to add this "\015" charcter in the end of every record.
the file contains something like 700 records.
i've tried with sed command - nothing.
... (8 Replies)
Discussion started by: naamas03
8 Replies
4. Shell Programming and Scripting
Hi
i had String like
UID: ABC345QWE678GFK345SA90, LENGTH 32
when I used awk ' FS, {print $1}' prints
ABC345QWE678GFK345SA90,
how can i getrid of that coma at the end of the string.
Thanks in advance.. (14 Replies)
Discussion started by: Reddy482
14 Replies
5. HP-UX
Hi Experts,
I have data coming in 4 columns and there are new line characters \n in between the data. I need to remove the new line characters in the middle of the row and keep the \n character at the end of the line.
File is comma (,) seperated.
Eg:
ID,Client ,SNo,Rank
37,Airtel \n... (8 Replies)
Discussion started by: sasikari
8 Replies
6. Shell Programming and Scripting
Hello friends,
I have a file which consists of many rows, I use a couple of commands to convert it so i can use in a database query for filtering. I need the first columns (msisdns) in a row, seperated with commas,
9855162267,4,5,2010-11-03 17:02:07.627
9594567938f,5,5,2010-11-02... (9 Replies)
Discussion started by: EAGL€
9 Replies
7. Shell Programming and Scripting
In a 10-50GB file , at end of file there is Control-z character
tried the below options,
1. perl -p -i -e 's/^Z//g' new.txt
2. perl -0777lwi -032e0 new.txt
and Sed command, dos2unix etc
it takes more time to remove the control-z. need a command or perl program to GO TO LAST LINE OF FILE ... (7 Replies)
Discussion started by: prsam
7 Replies
8. Shell Programming and Scripting
I need to remove new line character from end of file.
Suppose here are content.
a|b|c|d|r
a|b|c|d|r
a|b|c|d|r
<new line>
that means file contains 4 lines but data is there in 3 lines.
so I want that only 3 lines should be there in file.
Please help (20 Replies)
Discussion started by: varun940
20 Replies
9. UNIX for Dummies Questions & Answers
I have a file, I need to remove the first character of each line, but only if it's a comma. I don't want to delete any other commas in each line.
Trying cat or sed but I really don't know them very well, would love some help.
This removes the first comma, but it removes the first comma no... (6 Replies)
Discussion started by: Cynthia
6 Replies
10. Shell Programming and Scripting
Hi,
How can we remove the comma from the end of each line.
I have a csv file in below format.
file.csv
Name,age,gender,location,
Joel,18,M,Newyork,
Monoj,21,M,Japan,
Litu,23,M,turki,
Expected o/p
file1.csv
Name,age,gender,location (4 Replies)
Discussion started by: Litu19
4 Replies
LEARN ABOUT MOJAVE
fparseln
FPARSELN(3) BSD Library Functions Manual FPARSELN(3)
NAME
fparseln -- return the next logical line from a stream
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdio.h>
#include <util.h>
char *
fparseln(FILE *stream, size_t *len, size_t *lineno, const char delim[3], int flags);
DESCRIPTION
The fparseln() function returns a pointer to the next logical line from the stream referenced by stream. This string is NUL terminated and
it is dynamically allocated on each invocation. It is the responsibility of the caller to free the pointer.
By default, if a character is escaped, both it and the preceding escape character will be present in the returned string. Various flags
alter this behaviour.
The meaning of the arguments is as follows:
stream The stream to read from.
len If not NULL, the length of the string is stored in the memory location to which it points.
lineno If not NULL, the value of the memory location to which is pointed to, is incremented by the number of lines actually read from the
file.
delim Contains the escape, continuation, and comment characters. If a character is NUL then processing for that character is disabled. If
NULL, all characters default to values specified below. The contents of delim is as follows:
delim[0] The escape character, which defaults to , is used to remove any special meaning from the next character.
delim[1] The continuation character, which defaults to , is used to indicate that the next line should be concatenated with the
current one if this character is the last character on the current line and is not escaped.
delim[2] The comment character, which defaults to #, if not escaped indicates the beginning of a comment that extends until the end
of the current line.
flags If non-zero, alter the operation of fparseln(). The various flags, which may be or-ed together, are:
FPARSELN_UNESCCOMM Remove escape preceding an escaped comment.
FPARSELN_UNESCCONT Remove escape preceding an escaped continuation.
FPARSELN_UNESCESC Remove escape preceding an escaped escape.
FPARSELN_UNESCREST Remove escape preceding any other character.
FPARSELN_UNESCALL All of the above.
RETURN VALUES
Upon successful completion a pointer to the parsed line is returned; otherwise, NULL is returned.
The fparseln() function uses internally fgetln(3), so all error conditions that apply to fgetln(3), apply to fparseln(). In addition
fparseln() may set errno to ENOMEM and return NULL if it runs out of memory.
SEE ALSO
fgetln(3)
HISTORY
The fparseln() function first appeared in NetBSD 1.4.
BSD
December 1, 1997 BSD