Sponsored Content
Top Forums Shell Programming and Scripting awk to extract value from column using variable Post 302973423 by ncwxpanther on Tuesday 17th of May 2016 03:24:31 PM
Old 05-17-2016
Thanks to all that replied. Great examples!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

can awk print column using a variable ??

i want to print the column file using awk or cut in dynamic manner like trmp=2;temp1=1;temp3=2 awk 'BEGIN{OFS=IFS="\t"} {print $temp,$temp1,$temp3}' client_data.txt or cut -f $temp1,$temp2,$temp3 -d"\t" file_name . but it is showing error , In awk can i use variable as in printing... (36 Replies)
Discussion started by: jambesh
36 Replies

2. Shell Programming and Scripting

How to extract a column from two different files in AWK?

Hi guys, I need help in extracting one column of numbers from two different files and display it in a output file. In specific, I want to extrac the column no.2 ($2) from each file, file1.txt, file2.txt. Then place both extracted columns in a one file, out.txt. the line command I use to... (7 Replies)
Discussion started by: solracq
7 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

awk/sed to extract column bases on partial match

Hi I have a log file which has outputs like the one below conn=24,196 op=1 RESULT err=0 tag=0 nentries=9 etime=3,712 dbtime=0 mem=486,183,328/2,147,483,648 Now most of the time I am only interested in the time ( the first column) and a column that begins with etime i.e... (8 Replies)
Discussion started by: pkabali
8 Replies

5. Shell Programming and Scripting

for each different entry in column 1 extract maximum values from column 2 in unix/awk

Hello, I have 2 columns (1st column has multiple entries but the corresponding values in the column 2 may be the same or different.) however I want to extract unique values for each entry in column 1 by assigning the max value from column 2 SDF4 -0.211654 SDF4 0.978068 ... (1 Reply)
Discussion started by: Diya123
1 Replies

6. Shell Programming and Scripting

Printing a variable column using awk

Hi everyone, Ok here's the scenario. I have a control file like this. component1,file1,file2,file3,file4,file5 component2,file1,file2,file3,file4,file5I want to do a while loop here to read all files for each component. file_count=2 while ] do file_name=`cat list.txt | grep... (2 Replies)
Discussion started by: The Gamemaster
2 Replies

7. Shell Programming and Scripting

Need to extract data from Column having variable length column

Hi , I need to extract data from below mentioned data, having no delimiter and havin no fixed column length. For example: Member nbr Ref no date 10000 1000 10202012 200000 2000 11202012 Output: to update DB with memeber nbr on basis of ref no. ... (6 Replies)
Discussion started by: ns64110
6 Replies

8. Shell Programming and Scripting

extract column with awk

This is a example TXT file: ID CDR1 CDR2 CDR3 1 CDR1 CDR3 2 CDR1 CDR2 CDR3 3 CDR3 What I want to do is extract the fourth column with awk, however, there are some blank space in some field. I get wrong result when it print out awk result. awk '{print $1,$4}'... (8 Replies)
Discussion started by: xshang
8 Replies

9. Shell Programming and Scripting

Compare files & extract column awk

I have two tab delimited files as given below: File_1: PV16 E1 865 2814 1950 PV16 E2 2756 3853 1098 PV16 E4 3333 3620 288 PV16 E5 3850 4101 252 PV16 E6 83 559 477 PV16 E7 562 858 297 PV16 L2 4237 5658 ... (10 Replies)
Discussion started by: vaibhavvsk
10 Replies

10. UNIX for Dummies Questions & Answers

awk - Extract 4 lines in Column to Rows Tab Delimited between tags

I have tried the following to no avail. xargs -n8 < test.txt awk '{if(NR%6!=0){p=""}else{p="\n"};printf $0" "p}' Mod_Alm_log.txt > test.txt I have tried different variations of the above, the problem is mixes lines together. And it includes the tags "%a and %A" I need them to be all tab... (16 Replies)
Discussion started by: mytouchsr
16 Replies
repl(1) 						      General Commands Manual							   repl(1)

NAME
repl - reply to a message (only available within the message handling system, mh) SYNOPSIS
repl [msg] [+folders] [options] OPTIONS
Marks out the original message as replied to. When the message is shown on the listing produced by scan, it is marked with a dash (-). The following lines are also added to the message: Replied: date Replied: addrs where the address list contains one line for each addressee. The mail system will annotate the message only if it is sent immedi- ately. If the message is not sent immediately, you can send it later with comp -use, but the annotations will not take place. Spec- ifies who will receive copies of the reply. By default the mail system sends the reply to the sender of the original message, and copies to all other names in the To: and cc: lines. You can change this behavior by using the -cc option. This sends copies of the replies only to the specified names. There are four values: -cc all sends copies to all the names on the original message; -cc to sends copies only to those names in the To: field; -cc cc sends copies only to those names in the cc: field; and -cc me sends a copy of the reply to yourself. There is also a -nocc option, which stops copies of the reply being sent to the named people. It takes the same values as -cc. So, for example, -nocc cc would stop replies being sent to the names in the cc: field of the original message. Specifies the folder in which the draft message is created. If you do not send the draft, it is stored in this folder. This option is usually set up in your See mh_profile(4) for more information. If you have this option set up, you can override it by using the -nodraftfolder option. Specifies the editor you wish to use to write your reply. The default editor provided is prompter. You can specify any legal editor as an alternative. You can also set up an editor in your file. See mh_profile(4) for more details. Specifies a folder to receive copies of your reply. More than one folder can be named, each preceded by -fcc. Specifies how the original message is formatted in the draft. By default, the mail system does not include a copy of the original message in your reply. If you use the -filter filterfile option, the original message may be included in your reply, and formatted according to the information in the file you name. The filter file for repl should be a standard form file for mhl, as repl will invoke mhl to format the message being replied to. There is no default filter file for repl; you must create your own. A filter file that is commonly used is: : body:nocomponent,compwidth=9,offset=9 This outputs a blank line and then the body of the message being replied to, indented by one tab-stop. Varies the appearance of the mail header for the reply. The mail system will construct the header according to the instructions in the named file. In order for repl to operate correctly, this must be an mhl file; see mh-format(4) for more information. This option overrides the header set up by the system file /usr/lib/mh/replcomps. Prints out a list of valid options to the command. Causes annotation to be done in place, in order to preserve links to the annotated message. Calls repl without an editor. This option takes you straight to the What now? prompt, without allowing you to edit your reply. This will usually produce a reply with no text in the body of the mes- sage. Allows you to modify the list of recipients. The mail system asks you whether each of the addresses that would normally be placed in the To: and cc: fields should actually receive a copy of the reply. Sets the maximum width of the header line. Lines exceeding this width are split. Specifies an alternative whatnow program. Normally, repl invokes the default whatnow program. See whatnow(1) for a discussion of available options. You can specify your own alternative to the default program using the -whatnowproc program option. If you do specify your own program, you should not call it whatnow. You can suppress the whatnow program entirely by using the -nowhatnowproc option. However, as the program normally starts the ini- tial edit, the -nowhatnowproc option will prevent you from editing the message. The default settings for this command are: +folder defaults to the current folder msg defaults to the current message -cc all -format -noannotate -nodraftfolder -noinplace -noquery -width 72 DESCRIPTION
Use repl to reply to a message that you have received. By default, repl replies to the current message in the current folder. If you want to reply to another message, you can specify a message number as the msg argument. You can also specify a message in another folder by supplying a +folder argument. You can supply both a msg and a +folder argument. If you specify a folder without giving a message number, repl will reply to the current message in the named folder. When you reply to a message, repl automatically fills in the mail header for you, taking the information it needs from the mail header of the original message. The following example shows how repl constructs the mail header for the return message: To: <Reply-To> or <From> or <sender> cc: <cc>, <To>, and yourself Subject: Re: <Subject> In-reply-to: Your message of <Date>. <Message-Id> Field names enclosed in angle brackets (< >) indicate the contents of the named field from the original message. Normally, repl replies to the original sender, and sends carbon copies to all the addressees on the original message. You can create a different mail header from the default and use it every time you reply to mail. If you create an alternative mail header and store it in the file replcomps in your Mail directory, repl will use it instead of the default header file. This must be an mhl file; see mh-format(4) for more information. If you do not have a draft folder set up, repl creates your new draft in a file called draft in your Mail directory. This file must be empty before you can create a new draft, which means that you can only store one draft at a time. If it is not empty, the mail system will ask you what you want to do with the existing contents. The options are: Aborts repl, leaving the draft intact. Replaces the existing draft with the appropriate message form. Displays the draft message. Refiles the existing draft message in the specified folder, and pro- vides a new message form for you to complete. If you want to be able to have more than one draft at a time, you can set up a draft folder in your you to keep as many unsent drafts as space allows, and still create new messages as you wish. To do this, make sure that the following line is in your Draft-folder: +drafts For more information on how to do this, see mh_profile(4). If you set up a draft folder, all draft messages are created in that folder. If you decide not to send the draft, by typing quit at the What now? prompt, the message is stored in the draft folder. You can then re-edit the message, or send it at a later date, by using the comp -use command. Note that while in the editor, the message being replied to is available through a link named @ (assuming the default whatnowproc). In addition, the actual pathname of the message is stored in the environment variable $editalt, and the pathname of the folder containing the message is stored in the environment variable $mhfolder. If your current working directory is not writable, the link named @ is not avail- able. PROFILE COMPONENTS
Path: To determine your Mail directory Alternate-Mailboxes: To determine your mailboxes Draft-Folder: To find the default draft folder Editor: To override the default editor Msg-Protect: To set mode when creating a new message (draft) fileproc: Program to refile the message mhlproc: Program to filter message being replied to whatnowproc: Program to ask the "What now?" questions EXAMPLES
This example replies to message number 15 in the current folder: % repl 15 The next example creates your reply in the folder +drafts. If you decide not to send the draft reply, the mail system will store it in this folder: % repl -draftfolder +drafts The next example places a copy of your reply in your +copylog folder: % repl -fcc +copylog FILES
The default system reply template. The user-supplied alternative to the standard reply template. The user profile. The draft file. SEE ALSO
comp(1), dist(1), forw(1), prompter(1), send(1), whatnow(1), mh-format(4) repl(1)
All times are GMT -4. The time now is 10:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy