Sponsored Content
Top Forums Shell Programming and Scripting Adding new lines to a file + adding suffix to a pattern Post 302428854 by zaxxon on Friday 11th of June 2010 05:09:53 AM
Old 06-11-2010
Code:
$> awk '/^name:/ {print $0 RS "employed" RS "permanently"; next} /^stat/ {print $0"-office"; next}1' infile
name: John Doe
employed
permanently
stationed: 1-office

name: Michael Sweets
employed
permanently
stationed: 41-office

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

adding text to a file between lines

Suppose content of my first file: first line second line third line How can i insert text between "first line" & "second Iline" Any help?????/ (7 Replies)
Discussion started by: bishweshwar
7 Replies

2. UNIX for Dummies Questions & Answers

Adding lines and columns to a file

Hi everybody, I've got two simples file1 like: aaa aaa aaa bbb bbb bbb ccc ccc ccc and file2 like: 111 111 111 222 222 222 333 333 333 I need to: 1) add a line say "new line" as the first line of the file 2)add a column from file2 (say column3) to file1; the new column should... (14 Replies)
Discussion started by: zajtat
14 Replies

3. Shell Programming and Scripting

Adding strings to lines in a file

Hi all, I have a positional text file that comes from some source application. Before it is processed by destination application I have to add some header (suffix) to every record(line) in the file. e.g. Actual File ............... AccountDetails AcNO Name Amount 1234 John 26578 5678... (3 Replies)
Discussion started by: sharath160
3 Replies

4. Shell Programming and Scripting

AWK adding prefix/suffix to list of strings

75 103 131 133 138 183 197 221 232 234 248 256 286 342 368 389 463 499 524 538 (5 Replies)
Discussion started by: chrisjorg
5 Replies

5. UNIX Desktop Questions & Answers

Adding lines to pattern space

Is there any way to add lines to the pattern space of sed? I know a bit about the N flag, but am not able to use it to do what I want which is: read a file n lines at a time. If I find a match I quit else move to the next line. e.g. if I am looking for the following three lines Hello How... (2 Replies)
Discussion started by: jawsnnn
2 Replies

6. UNIX for Dummies Questions & Answers

Adding missing lines in file

Dear all, I have a file with two columns - the first column is increasing every 50, the second column is just count (e.g. 5). However, when count is zero, no line is present. Sample: 1950 7 2000 14 2050 7 2100 13 2150 10 2200 9 2250 7 2300 8 2350 7... (1 Reply)
Discussion started by: TheTransporter
1 Replies

7. UNIX for Dummies Questions & Answers

Adding missing lines in file

Dear all, I have a file with two columns - the first column is increasing every 50, the second column is just count (e.g. 5). However, when count is zero, no line is present. Sample: How can I change the file so as to include lines with zero count? e.g. in the previous file to put... (4 Replies)
Discussion started by: TheTransporter
4 Replies

8. Shell Programming and Scripting

Adding lines at a particular location in a file.

Hi Experts, Let us take a text file,say items.txt having the following data jar bottle gum tube cereal bag I want to add the content of items.txt to another file say #many lines not necessary ingredients #many line not necesary ingredients I want to append the data in... (3 Replies)
Discussion started by: Pradeep_1990
3 Replies

9. Shell Programming and Scripting

Adding lines to a large file

Hello, I have a relatively large text file (25,000K) consisting of records of data. For each record, I need to create a new line based on what is already there. Every record has a block that looks like, M END > <ID> 1 > <SOURCE> KEGG > <SOURCE_ID> C00002 > <NAME> ATP;... (4 Replies)
Discussion started by: LMHmedchem
4 Replies

10. UNIX for Beginners Questions & Answers

Adding to an array in an external file, and adding elements to it.

I have an array in an external file, "array.txt", which contains: char *testarray={"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};I want to be able to add an element to this array, and have that element display, whenever I call it, without having to recompile... (29 Replies)
Discussion started by: ignatius
29 Replies
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)
All times are GMT -4. The time now is 06:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy