Sponsored Content
Full Discussion: Extract from txt file
Top Forums Shell Programming and Scripting Extract from txt file Post 302325926 by joeyg on Tuesday 16th of June 2009 01:17:59 PM
Old 06-16-2009
Hammer & Screwdriver OK, maybe this will get you started...

Code:
> cat file25
# disregard this data
aaa choice_a
bbb choice_b
ccc choice_C
ddd choice_d
# forget this line
eee choice_e

> cat play25.sh
awk '
  { 
    if ($1!="#")
      { 
#      print $0 
      opt[$1]=$1
      choice[$1]=$2
      }
  }
  END {
    for (i in opt)
    print "Option="opt[i]" and value ="choice[i]

  }
' file25

> play25.sh
Option=aaa and value =choice_a
Option=ccc and value =choice_C
Option=eee and value =choice_e
Option=bbb and value =choice_b
Option=ddd and value =choice_d

 

10 More Discussions You Might Find Interesting

1. Programming

c file to extract real value from a txt file

Hello Friends,, I m really a new bee to C programms , please help me with a code.. I found some theads here similar to this but Not able to solve what exactly I want.. suppose I ve txt file as below. abc.txt 12 23 10 11 131 159 12.2 13.8 Then I want to... (7 Replies)
Discussion started by: user_prady
7 Replies

2. UNIX for Dummies Questions & Answers

Binary txt file received when i use uuencode to send txt file as attachment

Hi, I have already read a lot of posts on sending attachments in unix...but none of them were of help for my problem...so here goes.. i wanna attach a text file and send to a mail id..used the following code : uuencode "$File1" "$File1" ;|mail -s "$Mail_sub" abc@abc.com it works... (2 Replies)
Discussion started by: ash22
2 Replies

3. Shell Programming and Scripting

Extract content from several txt-files

Hi! Im trying to write a script in ksh that creates a single txt-file from specific content in several other txt-files. From these files I want to extract all text after 'WORD' and before '=', regardless of number of lines and other content. I have tried cat and guess I need... (7 Replies)
Discussion started by: larsu
7 Replies

4. Shell Programming and Scripting

extract words from txt using perl

Hi, i will deal with txt file and i want to use perl to extract number of words from this txt ex :if the txt file is a story which contains person names and iwant to extract these names and there is something else that these names which i want perl to extract must match the words (person names) ... (2 Replies)
Discussion started by: eng_shimaa
2 Replies

5. UNIX for Dummies Questions & Answers

Extract numbers from .txt file

I need to extract all the p-value numbers and the rho numbers from a .txt file and write them as coma separated values in a new file. Ideally I would get two files in the end, one for p- values and one for rho. Any suggestions? I appreciate your help!!! The .txt file looks essentially like this... (5 Replies)
Discussion started by: eggali
5 Replies

6. Shell Programming and Scripting

Command to extract all columns except the last few from a txt file

hello, i have publicly available txt file with little less than 300000 rows. i want to extract from column 1 to column 218 and save it in another text file. i use the cut command but the file is saved with multiple rows from the source file onto a single row in the destination. basically it is... (6 Replies)
Discussion started by: madrazzii
6 Replies

7. Shell Programming and Scripting

Script extract text from txt file with grep

All, I require a script that grabs some text from the gitHub API and will grep (or other function) for a string a characters that starts with (") quotes followed by two letters, may contain a pipe |, and ending with ) . What i have so far is below but it's not returning anything. ... (4 Replies)
Discussion started by: ChocoTaco
4 Replies

8. Shell Programming and Scripting

Extract the filename and write to .txt

I'm new to this forum and also to UNIX scripting. I need a command to extract the filename from the path and write to .txt file. Thanks in advance for your guidance. (23 Replies)
Discussion started by: Ram Kumar_BE
23 Replies

9. Shell Programming and Scripting

Extract information from txt file

Hello! I need help :) I have a file like this: AA BC FG RF TT GH DD FF HH (a few number of rows and three columns) and I want to put the letters of each column in a variable step by step in order to give them as input in another script. So I would like to obtain: for the 1° loop:... (11 Replies)
Discussion started by: edekP
11 Replies

10. UNIX for Beginners Questions & Answers

To extract values after the maximum value in a txt file

Hello, I'm new to scripting and I need to write a bash script. Here is example of file on which I'm working: 0.3092381 0.3262799 0.3425480 0.3578379 0.3719490 0.3846908 0.3958855 0.4053738 0.4130160 0.4186991 0.4223357 ... (1 Reply)
Discussion started by: jeo_fb
1 Replies
frexp(3M)						  Mathematical Library Functions						 frexp(3M)

NAME
frexp, frexpf, frexpl - extract mantissa and exponent from a floating-point number SYNOPSIS
cc [ flag... ] file... -lm [ library... ] #include <math.h> double frexp(double num, int *exp); float frexpf(float num, int *exp); long double frexpl(long double num, int *exp); DESCRIPTION
These functions break a floating-point number into a normalized fraction and an integral power of 2. They store the integer exponent in the int object pointed to by exp. RETURN VALUES
For finite arguments, these functions return the value x, such that x is a double with magnitude in the interval [1/2, 1) or 0, and num equals x times 2 raised to the power *exp. If num is NaN, NaN is returned and the value of *exp is unspecified. If num is +- 0, +- 0 is returned and the value of *exp is 0. If num is +-Inf, num is returned and the value of *exp is unspecified. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
isnan(3M), ldexp(3M), modf(3M), attributes(5), standards(5) SunOS 5.10 16 Aug 2004 frexp(3M)
All times are GMT -4. The time now is 07:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy