06-19-2009
Quote:
Originally Posted by
tkleczek
It's a bit clumsy,
and unreadable.
Quote:
but i cannot think of the other way to check whether a sed substitute command actually changed anything.
obviously a wrong choice of tools. Better to use a good programming language.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Dear all
I have a file which looks like this
xxxxxxxxxxxxxx,xxx,xxxxxxxxxx
xxxxxxxxxxxxxx,xxx,xxxxxxxxxx
etc
basically 14 characters then a comma, three characters, then a comma then 10 characters. We are uploading this file to our mainframe and they want the commas removed, so it... (6 Replies)
Discussion started by: hcclnoodles
6 Replies
2. HP-UX
Hi Gurus,
There is a ASCII file in which a comma is used as a seperator for the amount field when the amount exceed seven digits: e.g. 0001300,000. Now, this comma needs to be removed from this field, after padding leading zeros (to maintain the ASCII positions) e.g. 00001300000.... (1 Reply)
Discussion started by: pranag21
1 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I get some flat files with trailer which gives the totol records count and i want to remove the trailer from the file.
i used the following command it works fine with a single file.
cat file_name | grep -v 'Total records:' > file1
mv file file_name
But i dont know how to remove the... (12 Replies)
Discussion started by: kumarsaravana_s
12 Replies
4. UNIX for Dummies Questions & Answers
hi
I have an expression
aaabbb; xxx xxxi
i need to get the ouput as
xxx xxxi
i am using sed -e 's/\(*;\)//g' but it is not working..??
can some one suggest..
This is urgent (9 Replies)
Discussion started by: aixjadoo
9 Replies
5. Shell Programming and Scripting
i have the below line as output from a script. I want to delete the string "," and get the output without comma,
cat D* | grep "bytes free" | awk '{print $3}' | ?????
output:
40,966,189,056
Desired O/P:
40966189056 (1 Reply)
Discussion started by: ali560045
1 Replies
6. Shell Programming and Scripting
Hi ,
Im relatively new to unix and have to process a comma serparated flat file . I recieve some of the fields in double quotes and i want to remove it ..
INPUT
====
filed1,field2,field3,"fie,ld4"
OUTPUT
=====
field1,field2,field3,"field4"
can anyone tell me how to achieve... (10 Replies)
Discussion started by: r_t_1601
10 Replies
7. Shell Programming and Scripting
Hi Experts,
I have below strings
hello,hi,,,,,,start date
age,code,,,,,61,season
I am trying to format this string to
hello,hi,start date
age,code,61,season
Can anyone please help me in achieving this?
Kind Regards,
RB (3 Replies)
Discussion started by: ramakanth_burra
3 Replies
8. Shell Programming and Scripting
Hi all,
I haven't needed to do any shell based editing for nearly 20 years, and no amount of searching around has found me a solution to this very simple problem :-(
I have a csv file.
Some lines have three commas at the end. This means the invoice hasn't been paid.
I'd like to use sed / grep... (4 Replies)
Discussion started by: chardyzulu
4 Replies
9. Shell Programming and Scripting
Hello Team,
Could you please help me with the below question?
I have a file with the following properties
1) File Delimiter is ;
2) Text columns are within double quotes
3) Numeric columns will not have double quotes
4) File has total 6 columns
Please see a sample record from file
... (3 Replies)
Discussion started by: sam99
3 Replies
10. UNIX for Beginners Questions & Answers
Hi
I'm creating a sh script to generate a csv file. The CSV contains the values from a sql table.
The content looks this:
a,b,c,c2,c3,,,,,,,,,,,d,e
I have some code that can separate the fields using the comma as delimiter, but some values actually contain commas, such as... (2 Replies)
Discussion started by: preema
2 Replies
LEARN ABOUT DEBIAN
bup-margin
bup-margin(1) General Commands Manual bup-margin(1)
NAME
bup-margin - figure out your deduplication safety margin
SYNOPSIS
bup margin [options...]
DESCRIPTION
bup margin iterates through all objects in your bup repository, calculating the largest number of prefix bits shared between any two
entries. This number, n, identifies the longest subset of SHA-1 you could use and still encounter a collision between your object ids.
For example, one system that was tested had a collection of 11 million objects (70 GB), and bup margin returned 45. That means a 46-bit
hash would be sufficient to avoid all collisions among that set of objects; each object in that repository could be uniquely identified by
its first 46 bits.
The number of bits needed seems to increase by about 1 or 2 for every doubling of the number of objects. Since SHA-1 hashes have 160 bits,
that leaves 115 bits of margin. Of course, because SHA-1 hashes are essentially random, it's theoretically possible to use many more bits
with far fewer objects.
If you're paranoid about the possibility of SHA-1 collisions, you can monitor your repository by running bup margin occasionally to see if
you're getting dangerously close to 160 bits.
OPTIONS
--predict
Guess the offset into each index file where a particular object will appear, and report the maximum deviation of the correct answer
from the guess. This is potentially useful for tuning an interpolation search algorithm.
--ignore-midx
don't use .midx files, use only .idx files. This is only really useful when used with --predict.
EXAMPLE
$ bup margin
Reading indexes: 100.00% (1612581/1612581), done.
40
40 matching prefix bits
1.94 bits per doubling
120 bits (61.86 doublings) remaining
4.19338e+18 times larger is possible
Everyone on earth could have 625878182 data sets
like yours, all in one repository, and we would
expect 1 object collision.
$ bup margin --predict
PackIdxList: using 1 index.
Reading indexes: 100.00% (1612581/1612581), done.
915 of 1612581 (0.057%)
SEE ALSO
bup-midx(1), bup-save(1)
BUP
Part of the bup(1) suite.
AUTHORS
Avery Pennarun <apenwarr@gmail.com>.
Bup unknown- bup-margin(1)