Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using GREP to extract variable following a string Post 302285342 by Radar on Sunday 8th of February 2009 05:37:22 PM
Old 02-08-2009
Code:
[radar@msi-k8t:~]$ cat testfile.txt
1 F= -.13250138E+03 E0= -.13249556E+03 d E =-.174650E-01 mag= 35.2157
[radar@msi-k8t:~]$ grep "1 F=" testfile.txt | awk '{print $3}'
-.13250138E+03

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

extract from string variable into new variables

I have a variable which consists of a string like this: 001 aaabc 44 a bbb12 How do I extract each substring, delimited by the spaces, into new variables - one for each substring? eg var1 will be 001, var2 will be aaabc, var3 will be 44, var4 will be a, etc? I've come up with this:... (2 Replies)
Discussion started by: Sniper Pixie
2 Replies

2. Shell Programming and Scripting

How to extract variable number from a String

hi,I am new to shell script,I have String,like this: Number of rows exported: 5321 the numbe at end could changing,how can I extract this number and assign it to a variable,then use it later in script. thanks. (19 Replies)
Discussion started by: vitesse
19 Replies

3. UNIX for Dummies Questions & Answers

Using GREP/AWK to extract a number and store it as a variable

Hello, I have a question regarding the awk command. Here is the line I need to grep: 1 F= -.13250138E+03 E0= -.13249556E+03 d E =-.174650E-01 mag= 35.2157 Instead of displaying the number in red I would like to store it as a variable such as X. Is there a way to do this? Thanks for any... (3 Replies)
Discussion started by: modey3
3 Replies

4. Shell Programming and Scripting

Search for string in a file and extract another string to a variable

Hi, guys. I have one question: I need to search for a string in a file, and then extract another string from the file and assign it to a variable. For example: the contents of the file (group) is below: ... ftp:x:23: mail:x:34 ... testing:x:2001 sales:x:2002 development:x:2003 ...... (6 Replies)
Discussion started by: daikeyang
6 Replies

5. Shell Programming and Scripting

sub-string extract between variable delimiters

I need to extract certain pieces from a string, wher delimiters may vary. For example A0 B0 C0 12345677 X0 Y0 Z0 A1-B1 C1 12345678 X1 Y0 Z0 A1/B2 C77 12345679 X2 Y0 Z0 I need to get C0 12345677 X0 C1 12345678 X1 C77 12345679 X2 I tried sed, see example below: echo 'A0 B0... (2 Replies)
Discussion started by: migurus
2 Replies

6. Shell Programming and Scripting

Search for string in a file, extract two another strings and concatenate to a variable

I have a file with <suit:run date="Trump Tue 06/19/2012 11:41 AM EDT" machine="garg-ln" build="19921" level="beta" release="6.1.5" os="Linux"> Need to find word "build" then extract build number, which is 19921 also release number, which is 6.1.5 then concatenate them to one variable as... (6 Replies)
Discussion started by: garg
6 Replies

7. Shell Programming and Scripting

Extract a string from a file and store it in variable

Hi, I've a file ImageSizeDetails.txt with the following contents: Image Name: swncd 01.10.00.04 Created: Wed Jan 9 14:05:48 2013 Image Type: ARM Linux Multi-File Image (gzip compressed) Data Size: 7351011 Bytes = 7178.72 kB = 7.01 MB Load Address: 00008000 Entry Point: ... (6 Replies)
Discussion started by: Parameswaran
6 Replies

8. UNIX for Dummies Questions & Answers

Extract variable name in a string

Hi, I'm doing a script to list all scripts called by a "master" script. But I have an issue as there is some variables in the name of the called scripts. Example: % cat master_script.sh ENVIR=PROD VERSION=1.2 /users/maturix/$ENVIR/program_$VERSION.shI would like my script displays a kind... (7 Replies)
Discussion started by: maturix
7 Replies

9. UNIX for Beginners Questions & Answers

Question on grep command (extract a string)

Dear all, I have a file a.txt like below: 1_234560_A_G_b37 1 2 1 2 2 2 ... 1_35465767_C_T_b37 2 1 1 2 2 2 ... 2_490638010_A_T_b37 1 2 1 2 2 2 ... 10_4567899_T_G_b37 2 2 1 2 2 2 ... ... what I want to do is extracting rows starting with "10_" like : 10_4567899_T_G_b37 2 2 1 2 2... (1 Reply)
Discussion started by: forevertl
1 Replies

10. UNIX for Beginners Questions & Answers

Grep a sub-string from a string stored in a variable.

For example: I am grepping "Hello" from a file and there are 10 matches. So all ten lines with match will get stored into a variable($match). Now I want to ignore those lines which have "Hi" present in that. Currently I tried this: match = grep "Hello" file | grep -v "Hi" file But that's not... (2 Replies)
Discussion started by: pavan
2 Replies
yencode(3tcl)					       Text encoding & decoding binary data					     yencode(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
yencode - Y-encode/decode binary data SYNOPSIS
package require Tcl 8.2 package require yencode ?1.1.2? ::yencode::encode string ::yencode::decode string ::yencode::yencode ?-name string? ?-line integer? ?-crc32 boolean? (-file filename | ?--? string) ::yencode::ydecode (-file filename | ?--? string) _________________________________________________________________ DESCRIPTION
This package provides a Tcl-only implementation of the yEnc file encoding. This is a recently introduced method of encoding binary files for transmission through Usenet. This encoding packs binary data into a format that requires an 8-bit clean transmission layer but that escapes characters special to the NNTP posting protocols. See http://www.yenc.org/ for details concerning the algorithm. ::yencode::encode string returns the yEnc encoded data. ::yencode::decode string Decodes the given yEnc encoded data. ::yencode::yencode ?-name string? ?-line integer? ?-crc32 boolean? (-file filename | ?--? string) Encode a file or block of data. ::yencode::ydecode (-file filename | ?--? string) Decode a file or block of data. A file may contain more than one embedded file so the result is a list where each element is a three element list of filename, file size and data. OPTIONS
-filename name Cause the yencode or ydecode commands to read their data from the named file rather that taking a string parameter. -name string The encoded data header line contains the suggested file name to be used when unpacking the data. Use this option to change this from the default of "data.dat". -line integer The yencoded data header line contains records the line length used during the encoding. Use this option to select a line length other that the default of 128. Note that NNTP imposes a 1000 character line length limit and some gateways may have trouble with more than 255 characters per line. -crc32 boolean The yEnc specification recommends the inclusion of a cyclic redundancy check value in the footer. Use this option to change the default from true to false. % set d [yencode::yencode -file testfile.txt] =ybegin line=128 size=584 name=testfile.txt -o- data not shown -o- =yend size=584 crc32=ded29f4f REFERENCES
[1] http://www.yenc.org/yenc-draft.1.3.txt BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category base64 of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
encoding, yEnc, ydecode, yencode CATEGORY
Text processing COPYRIGHT
Copyright (c) 2002, Pat Thoyts base64 1.1.2 yencode(3tcl)
All times are GMT -4. The time now is 09:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy