Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to remove comma from the last line of the file Post 302320229 by sandeep_1105 on Wednesday 27th of May 2009 11:26:40 AM
Old 05-27-2009
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,
3566,
4444,
9999

How can we do this?

Thanks
Sandeep
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Remove whitespaces between comma separated fields from file

Hello all, I am a unix dummy. I am trying to remove spaces between fields. I have the file in the following format 12332432, 2345 , asdfsdf ,100216 , 9999999 12332431, 2341 , asdfsd2 ,100213 , 9999999 &... (2 Replies)
Discussion started by: nitinbjoshi
2 Replies

2. UNIX for Advanced & Expert Users

remove unnecessary comma from file

HI all, I have a file with following data - test1 "ABC,D",1234,"XYZ,QWER",1234 "SZXA",9870,"ASD,QWERT",234 "XZ,SD",9478,"ADCS,AXZ",876 "WESR",8764,"AQZXAS",9888 "WESR",9898,"WESDRTSAW",3323 I need to get rid of unnecessary commas in fields having double quotes. Ouput - ... (1 Reply)
Discussion started by: sumeet
1 Replies

3. Shell Programming and Scripting

Find c28 to next comma in line of log file

I have somelogfile.log where I'm trying to find only the numbers which would start at c28 on the third line from the bottom and end at the next comma, so for somelogfile.log: bunch of text - 0, some other text - 123 or bunch of text - 123, some other text - 192831923 where I want either the... (5 Replies)
Discussion started by: unclecameron
5 Replies

4. Shell Programming and Scripting

How to grep after the first comma till the next comma in a line

Hi Can any one pls tell me how to grep this line POPULATION,69691,20120509 I want the number 69691 from the above line. How to grep from the first comma till the next comma. Thank You.:confused: (8 Replies)
Discussion started by: rxg
8 Replies

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

6. Shell Programming and Scripting

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, (6 Replies)
Discussion started by: RahulJoshi
6 Replies

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

8. UNIX for Dummies Questions & Answers

Add a field separator (comma) inside a line of a CSV file

Hi... I can't find my little red AWK book and it's been a long while since I've awk'd. But I need to take a CSV file and convert the first word of the fifth field to its own field by replacing a space with a comma. This is for importing a spreadsheet of issues into JIRA... Example: a line... (9 Replies)
Discussion started by: Tawpie
9 Replies

9. Shell Programming and Scripting

How to remove comma from first and last line?

Hi Gurus, I need to remove comma from first and last line. I tried below code, but no luck. It only remove first line. Gurus, please help. awk -F"," '{if(NR==1||NR==$NR) print $1; else print $0}' TEST sampe file: ABC HEADER TOTAL RECORDS ARE 2.00,,,,... (13 Replies)
Discussion started by: ken6503
13 Replies
lgroupmod(8)						      System Manager's Manual						      lgroupmod(8)

NAME
lgroupmod - Modify an user group SYNOPSIS
lgroupmod [OPTION]... group DESCRIPTION
Modifies the user group with name group. OPTIONS
-A, --admin-add=list Add users in comma-separated list among group's administrators. -a, --admin-remove=list Remove users in comma-separated list from group's administrators. Removing users that are not currently among group's administra- tors silently succeeds. -g, --gid=gid Change group's group ID to gid. -i, --interactive Ask all questions when connecting to the user database, even if default answers are set up in libuser configuration. -L, --lock Lock group. This prevents users from using the group password with newgrp(1) to become a member of group. -M, --member-add=list Add users in comma-separated list among group's members. -m, --member-remove=list Remove users in comma-separated list from group's members. Removing users that are not currently among group's members silently succeeds. -n, --name=name Rename group to name. -P, --plainpassword=password Set group's password to password. Note that the password can be viewed while running lgroupmod using tools such as ps(1). -p, --password=encrypted Set group's password to the password represented by the hash encrypted. Note that the hash can be viewed while running lgroupmod using tools such as ps(1). -U, --unlock Unlock group. EXIT STATUS
The exit status is 0 on success, nonzero on error. libuser Jan 11 2005 lgroupmod(8)
All times are GMT -4. The time now is 12:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy