Sponsored Content
Top Forums UNIX for Beginners Questions & Answers awk - If field value of consecutive records are the identical print portion of lines Post 303014666 by jvoot on Saturday 17th of March 2018 01:37:46 PM
Old 03-17-2018
Thanks Don. Unfortunately I noticed those suggested threads after I had responded to Scrutinizer. I really appreciate your own explanation here too as I continue to approach awk from a discipline far removed from computer science.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

finding and removing 2 identical consecutive words in a text

i want to write a shell script that correct a text file.for example if i have the input file: "john has has 2 apples anne has 3 oranges oranges" i want that the output file be like this: "john has 2 apples anne has 3 oranges" i've tried to read line by line from input text file into array... (11 Replies)
Discussion started by: cocostaec
11 Replies

2. Shell Programming and Scripting

Compare Tab Separated Field with AWK to all and print lines of unique fields.

Hi. I have a tab separated file that has a couple nearly identical lines. When doing: sort file | uniq > file.new It passes through the nearly identical lines because, well, they still are unique. a) I want to look only at field x for uniqueness and if the content in field x is the... (1 Reply)
Discussion started by: rocket_dog
1 Replies

3. Shell Programming and Scripting

AWK: combining consecutive values in a field

Hi, Here is my sample input X 2 AAA Y 3 BBB Y 2 CCC Z 4 DDD In field 1, if the value of one line is same as that of next line, I want to concatenate the corresponding value of the second line in the third field with the value of the third field of first line. And I dont need the third... (2 Replies)
Discussion started by: polsum
2 Replies

4. Shell Programming and Scripting

Using awk, print all the lines where field 8 is equal to x

Using awk, print all the lines where field 8 is equal to x I really did try, but this awk thing is really hard to figure out. file1.txt"Georgia","Atlanta","2011-11-02","x","","","","" "California","Los Angeles","2011-11-03","x","","","",""... (2 Replies)
Discussion started by: charles33
2 Replies

5. Shell Programming and Scripting

Scan a file in realtime and execute certain commands on encountering 5 consecutive identical lines

Mysql log has something like below: I need a bash shell script that will do the following: 1) The script will scan the mysql.log file constantly in real time (something like tail -F mysql.log) 2) If it encounters 5 consecutive identical lines then it would invoke some commands (say... (4 Replies)
Discussion started by: proactiveaditya
4 Replies

6. Shell Programming and Scripting

sed print all lines between second and third identical lines

I am trying to extract a table of data (mysql query output) from a log file. I need to print everything below the header and not past the end of the table. I have spent many hours searching with little progress. I am matching the regexp +-\{99\} with no problem. I just can't figure out how to print... (5 Replies)
Discussion started by: godfreydanials
5 Replies

7. Shell Programming and Scripting

awk print values between consecutive lines

I have a file in below format: file01.txt TERM TERM TERM ABC 12315 68.53 12042013 165144 ABC 12315 62.12 12042013 165145 ABC 12315 122.36 12052013 165146 ABC 12315 582.18 12052013 165147 ABC 12316 2.36 12052013 165141 ABC 12316 ... (8 Replies)
Discussion started by: alex2005
8 Replies

8. Shell Programming and Scripting

Awk: print lines with one of multiple pattern in the same field (column)

Hi all, I am new to using awk and am quickly discovering what a powerful pattern-recognition tool it is. However, I have what seems like a fairly basic task that I just can't figure out how to perform in one line. I want awk to find and print all the lines in which one of multiple patterns (e.g.... (8 Replies)
Discussion started by: elgo4
8 Replies

9. Shell Programming and Scripting

Combine identical lines and average the one variable field

I have the following file 299899 chrX_299716_300082 196 78.2903 299991 chrX_299982_300000 18.2538 Tajd:0.745591 FayWu:-0.245701 T2:1.45 299899 chrX_299716_300082 196 78.2903 299991 chrX_299982_300000 18.2538 Tajd:0.745591 FayWu:-0.245701 T2:0.283 311027 chrX_310892_311162 300 91.6452... (2 Replies)
Discussion started by: jfern
2 Replies

10. Shell Programming and Scripting

awk to print lines based on text in field and value in two additional fields

In the awk below I am trying to print the entire line, along with the header row, if $2 is SNV or MNV or INDEL. If that condition is met or is true, and $3 is less than or equal to 0.05, then in $7 the sub pattern :GMAF= is found and the value after the = sign is checked. If that value is less than... (0 Replies)
Discussion started by: cmccabe
0 Replies
mcxquery(1)						    BSD General Commands Manual 					       mcxquery(1)

NAME
mcxquery -- Managed Client (MCX) compositor query tool SYNOPSIS
mcxquery [options] [-user recordName] [-group recordName] [-computer spec] options: -o path Writes output to a file at the specified path. -format space | tab | xml Specifies the format of the output. -computerOnly Ignore values for -user and -group. -useCache Return the cached computer settings in the local node if they are available. -raw Dumps Directory Service data for records contributing to managed preferences. -forApple Convenience for specifying options when sending bug reports to Apple. Currently enables "-raw" and "-for- mat xml". See usage example below. -version Displays the current version of ManagedClient. DESCRIPTION
mcxquery is a utility to determine the effective managed preferences for a user logging in to a workgroup from a specific computer. -user Specify the short name of the user record to read managed preferences from. If this parameter is omitted, or a value of "=" speci- fied, the short name of the currently logged in console user will be used. -group Specify the short name of the group record to read managed preferences from. A value of "=" may be specified to mean the name of the workgroup (if any) chosen for the current login session. -computer Specify the computer record to read managed preferences from. The computer can be specified using either an Ethernet MAC address (e.g. "11:22:33:44:55:66"), a Hardware UUID (e.g. "00112233-4455-6677-8899-AABBCCDDEEFF") or the short name of the computer record itself (e.g. "lab1_12"). If this parameter is omitted, or a value of "=" specified, the record for the current computer will be used. EXAMPLES
mcxquery -user jane -group science -computer lab1_12 Displays the managed preferences that would be in effect if user "jane" logged in using workgroup "science" from the computer speci- fied in the "lab1_12" computer record. mcxquery -user jane -group science -computer 11:22:33:44:55:66 Displays the managed preferences that would be in effect if user "jane" logged in using workgroup "science" from a computer with an Ethernet MAC address of 11:22:33:44:55:66. mcxquery -user = -group = -computer guest Displays the managed preferences that would be in effect if the current user logged in using the current workgroup into a computer not specified by any computer record (i.e. a "guest" computer). mcxquery -user jane -group math Displays the managed preferences that would be in effect if the user "jane" logged into the "math" workgroup on the current com- puter. mcxquery -o /tmp/report.txt -format xml -user jane Writes the managed preferences that would be in effect if user "jane" logged into the current computer without a workgroup. The report is written in XML format to /tmp/report.txt. mcxquery -computerOnly -computer lab1_12 Displays the managed preferences for the computer specified in the "lab1_12" computer record only. Useful for determining managed settings when computer is at login window. mcxquery -computerOnly -computer 00112233-4455-6677-8899-AABBCCDDEEFF Displays the managed preferences for the computer with the Hardware UUID "00112233-4455-6677-8899-AABBCCDDEEFF". Supported on Mac OS X 10.6 and later. mcxquery -forApple -o results.plist Creates a plist, suitable for submitting along with bug reports to Apple, containing the managed preferences for the current user on the current computer. Also includes relevant records from Directory Services. Supported on Mac OS X 10.7 and later. SEE ALSO
dscl(1) MacOSX April 14, 2017 MacOSX
All times are GMT -4. The time now is 04:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy