05-27-2009
Jim,
My bad, i was not putting $ before s. I mean i was using sed 's/,$//' filename.
Now its works exactly i intended if i use your code sed '$s/,$//' filename
Thanks for your reply and you were right.
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
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
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
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
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 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
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
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
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
LEARN ABOUT SUSE
funcombine
funcombine(7) SAORD Documentation funcombine(7)
NAME
FunCombine - Combining Region and Table Filters
SYNOPSIS
This document discusses the conventions for combining region and table filters, especially with regards to the comma operator.
DESCRIPTION
Comma Conventions
Filter specifications consist of a series of boolean expressions, separated by commas. These expressions can be table filters, spatial
region filters, or combinations thereof. Unfortunately, common usage requires that the comma operator must act differently in different
situations. Therefore, while its use is intuitive in most cases, commas can be a source of confusion.
According to long-standing usage in IRAF, when a comma separates two table filters, it takes on the meaning of a boolean and. Thus:
foo.fits[pha==1,pi==2]
is equivalent to:
foo.fits[pha==1 && pi==2]
When a comma separates two spatial region filters, however, it has traditionally taken on the meaning of a boolean or. Thus:
foo.fits[circle(10,10,3),ellipse(20,20,8,5)]
is equivalent to:
foo.fits[circle(10,10,3) || ellipse(20,20,8,5)]
(except that in the former case, each region is given a unique id in programs such as funcnts).
Region and table filters can be combined:
foo.fits[circle(10,10,3),pi=1:5]
or even:
foo.fits[pha==1&&circle(10,10,3),pi==2&&ellipse(20,20,8,5)]
In these cases, it is not obvious whether the command should utilize an or or and operator. We therefore arbitrarily chose to implement the
following rule:
o if both expressions contain a region, the operator used is or.
o if one (or both) expression(s) does not contain a region, the operator used is and.
This rule handles the cases of pure regions and pure column filters properly. It unambiguously assigns the boolean and to all mixed cases.
Thus:
foo.fits[circle(10,10,3),pi=1:5]
and
foo.fits[pi=1:5,circle(10,10,3)]
both are equivalent to:
foo.fits[circle(10,10,3) && pi=1:5]
[NB: This arbitrary rule replaces the previous arbitrary rule (pre-funtools 1.2.3) which stated:
o if the 2nd expression contains a region, the operator used is or.
o if the 2nd expression does not contain a region, the operator used is and.
In that scenario, the or operator was implied by:
pha==4,circle 5 5 1
while the and operator was implied by
circle 5 5 1,pha==4
Experience showed that this non-commutative treatment of the comma operator was confusing and led to unexpected results.]
The comma rule must be considered provisional: comments and complaints are welcome to help clarify the matter. Better still, we recommend
that the comma operator be avoided in such cases in favor of an explicit boolean operator.
SEE ALSO
See funtools(7) for a list of Funtools help pages
version 1.4.2 January 2, 2008 funcombine(7)