04-26-2002
urgent sed help
Hi folks. I've tried to research this, but haven't found a good answer (could be my harried state).
At any rate, I have records that end with
two commas, a number, two commas
this could be anywhere from
,,01,,
to
,,09875953,,
I need to remove the last two fields (the number and last double comma) from these records.
However, I also have records that end in a number and two commas. I do not want to change these.
Also, the number of fields varies from record to record.
sed 's/,,*,,/,,/g' file > newfile
does not work.
What am I missing here?
Thanks in advance,
Kristy
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am writing a shell script on SunOS cosuaah01 5.9 Generic_118558-11 sun4u sparc SUNW,Sun-Fire-V440
machine. The shell script in.sh looks like this:
install_top=`pwd`
fl2=/d01/applptch/ptchora/iAS/Apache/Apache/cgi-bin/cxtool/display_report.pl
echo $fl2
mv $fl2 $fl2.old
sed 5c\... (6 Replies)
Discussion started by: bhatia333
6 Replies
2. Shell Programming and Scripting
Collegues
I am dealing with raw text files which is extracted from web pages.
I have to find sentances which contains more than 99 words and have to put a "." after the 99th or 98 th word .
Is there any possiblity to it in sed or awk
With regards
Jaganadh.H (5 Replies)
Discussion started by: jaganadh
5 Replies
3. Shell Programming and Scripting
Hello,
I need to use sed to replace a word in file.
My command is this:
sed "s/word_to_replace/'"${INPUT}"'/1 filename
and because INPUT="~@#$%^&*()-_=+{}\|;:<>,./?"
and / is also the delimiter so I'm keep on getting error message
sed: command garbled: ...
any suggestions about how I... (10 Replies)
Discussion started by: katrvu
10 Replies
4. Shell Programming and Scripting
Hi all,
Actually i want to delete the .ps extension from package1.ps string by using sed.
Can any body tell me that how shell i do it?????????
It is very urgent. Can anybody help me. I am trying to do this in the following way.
ps_file="package1.ps"
echo $ps_file
sed s/.ps//g $ps_file... (9 Replies)
Discussion started by: sunitachoudhury
9 Replies
5. Infrastructure Monitoring
Hello All,
My problem is:
I want to replace a line from a file with sed. The first word in that line is always the same in every server. The second line is server model, which of course will vary from platform to platform and I need to leave that word as it is. After the second word, I need to... (3 Replies)
Discussion started by: solaix14
3 Replies
6. Shell Programming and Scripting
Hi
Im running this command on AIX in ksh.
My input file samp1 contains
1
2
123
12345
When I execute the following sed i dont get a matching pattern
sed -n '/{1}/p' samp1
Can anyone help me with this simple thing (3 Replies)
Discussion started by: raghav288
3 Replies
7. Shell Programming and Scripting
Hello,
I have a file with the follwoing pattern:
Input file:
===========
tcp://xxx:123
8179 YY
1798 YY
tcp://abc:2345
not found
tcp://swt:4945
7356 QQ
tcp://pqr:456
8178 PP
9485 PP
4485 PP (8 Replies)
Discussion started by: uandme2k2
8 Replies
8. Shell Programming and Scripting
HI all,
i have a line in a file it cantains
one;two_1_10;two_2_10;two_3_10;three~
now i need to get the output as
one;two_1_abc_10;two_2_abc_10;two_3_abc_10;three~ ( 1 should be replaced with 1_abc for two__10 , and one more thing the number of occurances of two_value_10 will be... (1 Reply)
Discussion started by: 2001.arun
1 Replies
9. Shell Programming and Scripting
Hi,
Sample Input
Table 1 XXXXX YYYYY
A 1 2 3 4 5
B 1 2 3 4 5
C 1 2 3 4 5
D 1 2 3 4 5
A 6 7
B 6 7
C 6 7
D 6 7
Table 2 XXXXX YYYYY
E 1 2 3 4 5
F 1 2 3 4 5
E 6 7
F 6 7
Table 3 XXXXX YYYYY
G 1 2 3 4 5 (4 Replies)
Discussion started by: ravin
4 Replies
10. Shell Programming and Scripting
sort.sh
------
ls -lSr|cat -n/*gives the detailed description o files with a serial number concatenated*/
i=0
n=10
j=$n
if
then
while
do
(sh -C sub.sh $i $j)&
((i++))
((j--))
done
fi
if
then
while
do
(sh -C sub.sh $i $j)& (1 Reply)
Discussion started by: dishak
1 Replies
QOS(7) Miscellaneous QOS(7)
NAME
qos - Quality of Service specification
DESCRIPTION
The text2qos and qos2text functions use the format described in this man page. Because all standard ATM tools on Linux use those functions
to convert to or from the textual representation of QOS specifications, they expect them in the same format too.
The most fundamental parameters are the traffic class and the AAL (ATM Adaption Layer) type. If the connection is bi-directional, both
directions have the same traffic class and the same AAL type. The traffic class and the AAL type are the first elements (in any order) in a
QOS specification. The traffic class is the only required element. If the AAL type is omitted, the application will provide a default
value. The following traffic classes are recognized:
ubr Unassigned Bit Rate
cbr Constant Bit Rate
abr Available Bit Rate
The following AAL types are recognized:
aal0 ("raw ATM")
aal5
If both, the traffic class and the AAL type are specified, they are separated by a comma.
If more parameters are supplied, the traffic class and AAL type must be followed by a colon. Traffic parameters can be specified indepen-
dently for the transmit and the receive direction. Their parameter lists are prefixed with tx: and rx:, respectively. If both parameter
lists are present, the tx: list must precede the rx: list. If a parameter is equal for both directions, it can be placed in a common param-
eter list (without prefix). The general format is as follows:
class_and_aal:common_list,tx:list,rx:list
Each list consists of elements specifying a parameter. Elements can appear in any order and they are separated with commas. The following
elements are recognized:
pcr=rate
is a synonym for max_pcr=rate
max_pcr=rate
The upper limit for the peak cell rate to assign. If omitted, any rate up to link speed may be chosen.
min_pcr=rate
The lower limit for the peak cell rate to assign. If omitted, any rate above zero can be chosen.
sdu=size
is a synonym for max_sdu=size
max_sdu=size
The size of the largest packet that may be sent or received. If omitted, a context-dependent default value is used.
Values are specified as follows:
rate The (decimal) rate, optionally followed by a unit. The unit may be prefixed with one of the multipliers k, M, or G, meaning 1'000,
1'000'000, or 1'000'000'000, respectively. The units cps (cells per second) and bps (bits per second) are recognized. If multiplier
and unit are omitted, cells per second are assumed. Note that the rate is always converted to cells per second, so rounding errors
may occur when specifying the rate in bits per second. Rates measured in bits per second are considered to be user data rates, i.e.
one cell corresponds to 384 bits. The rate can be a fractional value, e.g. 1.3Mbps. It is an error to specify only a multiplier
without a unit. Link speed can be indicated by using the keyword max as the rate.
size The (decimal) number of bytes.
The tx: or rx: lists may also just contain the single element none, which indicates that the corresponding direction is not used. It is an
error to specify none for both direction.
Note that commas must never follow colons or other commas. Also, whitespace is not allowed inside a QOS specification. QOS specifications
are case-insensitive.
EXAMPLES
Each of the following lines contains a valid QOS specification:
ubr
ubr:pcr=100kbps
cbr,aal0:pcr=64kbps
CBR:max_pcr=11Mbps,min_pcr=10mbps,sdu=8192
aal5,ubr:tx:none
cbr:tx:pcr=30000,rx:none
The following specificiations are equivalent:
CBR,AAL5:PCR=48Mbps
cbr,aal5:max_pcr=125000
cbr,aal5:tx:pcr=125kcps,rx:pcr=125kcps
AUTHOR
Werner Almesberger, EPFL LRC/ICA <werner.almesberger@epfl.ch>
Linux April 20, 2000 QOS(7)