Sponsored Content
Full Discussion: Extracting part of a word
Top Forums UNIX for Dummies Questions & Answers Extracting part of a word Post 302762291 by zazzybob on Monday 28th of January 2013 10:06:52 AM
Old 01-28-2013
Yup - many ways to skin the cat.

As for the question about multiple lines - yes

Code:
bash-3.2$  sed 's/^.*,\(FG=[^}]*\)}.*$/\1/' input_file > output_file

Even works over multiple files:

Code:
bash-3.2$ for i in 1 2 3 4; do
> echo "message={TP=2012:09:23:00:00:00:GMT,SD=2012:09:23:00:00:00:GMT,SP=2,FT=CCGT,FG=360${i}}" > file_${i}
> done
bash-3.2$ sed 's/^.*,\(FG=[^}]*\)}.*$/\1/' file_{1,2,3,4} > foo.txt
bash-3.2$ cat foo.txt
FG=3601
FG=3602
FG=3603
FG=3604

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extracting uncommon part between two files

Hi, I need to extract the uncommon (better say incremental) part from 2 files say file_1 and file_2. file_2 contains everything that is in file_1. That is file_2 has been created internally somehow : cat file_1 temp_file > file_2 My objective is to extract the temp_file part from... (2 Replies)
Discussion started by: sabyasm
2 Replies

2. Shell Programming and Scripting

Extracting part of the basename

Hi, I was wondering if there is an easy way to strip off the required basename. I have a script called apb0110021.sh and the contents of the script are typeset -u MScript=`basename $0 | cut -d. -f1` scriptname=sys.Audit.ksh parms="PROJECT1 dsAudit $MScript 1 BEGIN" $SCRIPTS/$scriptname... (3 Replies)
Discussion started by: madhunk
3 Replies

3. Shell Programming and Scripting

Extracting part of a string

Hi all, I have to extract only the second part of a database column (VARCHAR) and the value is seperated by a "~" xyz~ chxyz36r~ abder~000082685 mnops~000083554 fulfil302~00026 Above are some examples of the values and for each record I have to extract the value after "~" , if there is a... (8 Replies)
Discussion started by: sam_78_nyc
8 Replies

4. Shell Programming and Scripting

need help extracting this part

JADE TRADER 143W MYPEN 40 HC M X10 28 7 1 0 MYPEN 20 GP X X10 15 2 1 0 MYPEN 40 GP X X10 28 7 1 0 MYPEN 20... (6 Replies)
Discussion started by: finalight
6 Replies

5. Shell Programming and Scripting

awk: Extracting part of the buffer

Hi, I am trying to extract part of a line using "awk". My requirement is to extract the value $6 (which is the last parameter) from a line. As the sixth value contains some space, i am getting only part of the string. so i am trying to extract from $6 to the end of the buffer. How to do it... (7 Replies)
Discussion started by: venkat_k
7 Replies

6. Shell Programming and Scripting

grep part of word or Another word from a string

Hi all, FileOne family balance >>>>> 0 0 0 0 java.io.FileNotFoundException: Settings.xml (No such file or directory) at java.io.FileInputStream.open(Native Method) .. .... ..... ..... java.lang.NullPointerException ... ..... ...... Stacktrace: at... (2 Replies)
Discussion started by: linuxadmin
2 Replies

7. Shell Programming and Scripting

extracting part of a line excluding particular word from it

here is the line on which i want to process `empNo` int(13) NOT NULL AUTO_INCREMENT, it sometimes doesnt have comma at the end too `empNo` int(13) NOT NULL AUTO_INCREMENT i want to extract all except "AUTO_INCREMENT" not only this line i ,want the code to work on any line if it has... (5 Replies)
Discussion started by: vivek d r
5 Replies

8. Shell Programming and Scripting

Help with extracting a part of a line between two patterns

Hello All, I have a text file with contents as below: contents of error.txt: message1="Reason for error code1" message2="Reason for error code2" message3="Reason for error code3. To solve this, you may try doing restart" I have a requirement where in I have to... (4 Replies)
Discussion started by: asterisk-ix_use
4 Replies

9. Shell Programming and Scripting

Extracting a part of a string

Hi, I needed to extract some specific characters from a string based on user input. For example: After the script executes the user enters the following details: Please enter the string: This is a shell script Please enter the starting position: 11 Please enter the number of characters to be... (4 Replies)
Discussion started by: ChandanN
4 Replies

10. Shell Programming and Scripting

Extracting the part of string

I have a string: 2015-04-16 07:30:05,625000 +0900 xxxx.com I just want to extract the time from the above line I am using the below syntax x=~ /(.*) (\d+)\:(\d+)\:(\d+),(.*)\.com/ $time = $2 . ':' . $3 . ':' . $4; print $time But it is not working. Can some1 please help (2 Replies)
Discussion started by: karan8810
2 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 04:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy