Sponsored Content
Full Discussion: awk one liner
Top Forums Shell Programming and Scripting awk one liner Post 302759947 by cabrao on Wednesday 23rd of January 2013 06:37:32 AM
Old 01-23-2013
awk one liner

The below code is a simple modified sample from a file with millions of lines containing hundreds of extra columns xxx="yyy" ...
Code:
<app addr="1.2.3.4" rem="1000" type="aaa" srv="server1" usr="user1"/>
<app usr="user2" srv="server2" rem="1001" type="aab" addr="1.2.3.5"/>

What's the most efficient awk one liner in order to have the below result? (srv-usr-addr)
Code:
server1-user1-1.2.3.4
server2-user2-1.2.3.5

P.S - Sed or perl are welcome too..

Thanks in advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

3 files in one awk one liner

I have three files and I have to do something like this:- File A 1232|||1111 0001||| 1232|||2222 0001||| 1232|||4444 0001||| 1232|||4444 0001||| File B 1232|1111 0001|||002222|| 1232|2222 0001|||003333|| 1232|3333 0001|||004444|| File C 1232|002222||| 1232|005555||| Files are... (4 Replies)
Discussion started by: kishal
4 Replies

2. Shell Programming and Scripting

awk one liner

input a 100 200 300 b 400 10 output a 100 a 200 a 300 b 400 b 10 Thanx (6 Replies)
Discussion started by: repinementer
6 Replies

3. UNIX for Dummies Questions & Answers

awk one liner

I need a one liner to" find /pattern/ print from x lines before "pattern" to y lines after "pattern" (3 Replies)
Discussion started by: kenneth.mcbride
3 Replies

4. Shell Programming and Scripting

grep-awk one liner help

Hi guys, I'm trying to create a one line command that does the following. I will post my command first so you can get the idea better: ls -larht | awk '{print $4}' | uniq | xargs grep * __________ ls -larht | awk '{print $4}' | uniq This will post the name of the groups of each file... (2 Replies)
Discussion started by: erick_tuk
2 Replies

5. UNIX for Dummies Questions & Answers

need an awk one liner

example input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 (3 Replies)
Discussion started by: kenneth.mcbride
3 Replies

6. Shell Programming and Scripting

Awk one-liner?

Hello, I have two files... File #1 1 3 2 5 File #2 3 5 3 1 3 7 9 1 5 2 5 8 3 3 1 I need to extract all lines from File #2 where the first two columns match each line of File #1. So in the example, the output would be: 1 3 7 2 5 8 Is there a quick one-liner that would... (4 Replies)
Discussion started by: palex
4 Replies

7. Shell Programming and Scripting

Search & Replace regex Perl one liner to AWK one liner

Thanks for giving your time and effort to answer questions and helping newbies like me understand awk. I have a huge file, millions of lines, so perl takes quite a bit of time, I'd like to convert these perl one liners to awk. Basically I'd like all lines with ISA sandwiched between... (9 Replies)
Discussion started by: verge
9 Replies

8. Shell Programming and Scripting

figuring out an awk one liner

I have googled around a bit and could not find an answer to how this works: echo $STRING | awk '$0=$NF' FS= I know what each part is doing. The record is being set to equal the last field and the field separator is being set to null so that each character is considered a field. Why can FS= be... (4 Replies)
Discussion started by: benalt
4 Replies

9. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

10. UNIX for Dummies Questions & Answers

awk or sed one liner

I have a data base of part numbers: AAA Thing1 BBB Thing2 CCC Thing3 File one is a list of part numbers: XXXX AAA234 XXXX BBB678 XXXX CCC2345 Is there a sed one-line that would compare a data base with and replace the part numbers so that the output looks like this? XXXX AAA234... (7 Replies)
Discussion started by: jimmyf
7 Replies
xdriver(1grass) 						Grass User's Manual						   xdriver(1grass)

NAME
XDRIVER - GRASS Monitor - driver to display GRASS maps in X11 environment. (drivers) DESCRIPTION
The GRASS XDRIVER can be used to display GRASS maps in X11 environment. Usage in details Variables: GRASS_WIDTH set the x size in pixel for the XDRIVER (default: 640) GRASS_HEIGHT set the y size in pixel for the XDRIVER (default: 480) XDRIVER_TRUECOLOR=[TRUE|FALSE] Look for a TrueColor visual (?) XDRIVER_WINDOW ? XDRIVER_PRIVATE_CMAP Private color map (?) XDRIVER_LEFT defines the left position of GRASS monitor (removed?) XDRIVER_TOP define the upper position of GRASS monitor (removed?) Set the XDRIVER size # bash shell syntax: export GRASS_WIDTH=xxx export GRASS_HEIGHT=yyy # c shell syntax: setenv GRASS_WIDTH xxx setenv GRASS_HEIGHT yyy To control the XDRIVER, use the d.mon module. The maximum color depth depends on the current X Server settings. SEE ALSO
Display drivers HTMLMAP driver, PNG driver, PostScript driver d.frame, d.mon, g.region d.rast, d.vect AUTHORS
CERL various improvements from several authors. Rewritten 2001 by Glynn Clements Last changed: $Date: 2008-03-23 15:34:53 +0100 (Sun, 23 Mar 2008) $ Full index (C) 2003-2011 GRASS Development Team GRASS 6.4.2 xdriver(1grass)
All times are GMT -4. The time now is 04:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy