Sponsored Content
Top Forums Shell Programming and Scripting How to Remove comma as last character in end of last line of file? Post 302772308 by Subbeh on Monday 25th of February 2013 04:20:43 AM
Old 02-25-2013
Quote:
Originally Posted by RahulJoshi
thanks Subbeh !!! it worked for me Smilie
Could you please explain how it works ?
It's pretty simple, the first '$' specifies the last line, then you tell sed to remove ',$' ($ is end of line) from the string.
 

10 More Discussions You Might Find Interesting

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

2. UNIX for Dummies Questions & Answers

How to remove comma from the last line of the file

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

add character to every end-of line in file

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

Awk: Remove comma at the end of the string

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

How to remove new line character and append new line character in a file?

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

Remove comma and next rows beginning from the end

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

perl cmd to remove the control-Z character at end of 10GB file

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

How to remove new line character at end of file.

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

Remove First Char from Line in File Only if it's a comma

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

How can we remove comma from end of each line ?

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
STRIP(1)						    BSD General Commands Manual 						  STRIP(1)

NAME
strip -- discard information from ELF objects SYNOPSIS
strip [-d | -g | -S | --strip-debug] [-h | --help] [--only-keep-debug] [-o outputfile | --output-file=outputfile] [-p | --preserve-dates] [-s | --strip-all] [--strip-unneeded] [-w | --wildcard] [-x | --discard-all] [-I format | --input-target=format] [-K symbol | --keep-symbol=symbol] [-N symbol | --strip-symbol=symbol] [-O format | --output-target=format] [-R sectionname | --remove-section=sectionname] [-V | --version] [-X | --discard-locals] file ... DESCRIPTION
The strip utility is used to discard information from ELF objects. The strip utility supports the following options: -d | -g | -S | --strip-debug Remove debugging symbols only. -h | --help Print a help message and exit. --only-keep-debug Remove all content except that which would be used for debugging. -o outputfile | --output-file=outputfile Write the stripped object to file outputfile. The default behaviour is to modify objects in place. -p | --preserve-dates Preserve the object's access and modification times. -s | --strip-all Remove all symbols. --strip-unneeded Remove all symbols not needed for further relocation processing. -w | --wildcard Use shell-style patterns to name symbols. The following meta-characters are recognized in patterns: ! If this is the first character of the pattern, invert the sense of the pattern match. * Matches any string of characters in a symbol name. ? Matches zero or one character in a symbol name. [ Mark the start of a character class. Remove the special meaning of the next character in the pattern. ] Mark the end of a character class. -x | --discard-all Discard all non-global symbols. -I format | --input-target=format These options are accepted, but are ignored. -K symbol | --keep-symbol=symbol Keep the symbol symbol even if it would otherwise be stripped. This option may be specified multiple times. -N symbol | --strip-symbol=symbol Remove the symbol symbol even if it would otherwise have been kept. This option may be specified multiple times. -O format | --output-target=format Set the output file format to format. For the full list of supported formats, please see the documentation for function elftc_bfd_find_target(3). -R sectionname | --remove-section=sectionname Remove the section named by the argument sectionname. This option may be specified multiple times. -V | --version Print a version identifier and exit. -X | --discard-locals Remove compiler-generated local symbols. DIAGNOSTICS
The strip utility exits 0 on success, and >0 if an error occurs. SEE ALSO
ar(1), elfcopy(1), ld(1), mcs(1), elf(3), elftc_bfd_find_target(3), fnmatch(3) BSD
September 17, 2011 BSD
All times are GMT -4. The time now is 11:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy