Sponsored Content
Top Forums Shell Programming and Scripting BASH: Swap first two lines in sets of 4 Post 302556449 by SilversleevesX on Sunday 18th of September 2011 02:52:50 PM
Old 09-18-2011
BASH: Swap first two lines in sets of 4

Hi.

I may have mentioned in the OP to this thread that the AHK macro script I was trying to sort was, relative to its full length, only partly in the right format to be sorted by the methods discussed in that thread.

Now I'm looking to tackle the rest of the data in that AHK script.

Example data:
Code:
::god::
;Great Outdoors
Send, Great Outdoors,
Exit

::sand::
;On The Beaches
Send, On The Beaches,
Exit

::budapest::
;Hungarian Honeys
Send, Hungarian Honeys,
Exit

::ukgirl::
;British Birds & Belles
Send, British Birds & Belles, 
Exit

::fool::
;Getting Goofy::
Send, Getting Goofy,
Exit

I did the first one by hand (actually by using some awk commands in terminal) to show what I mean by "swap."
Code:
;Great Outdoors
::god::
Send, Great Outdoors,
Exit

Now I'm looking to automate the process for the rest of the data that's formatted as the above. In my C&P from the original AHK file, I count 45 such "quatrains" (4-line sets of data). I may have missed some in cutting and pasting.

Though the subject line of this OP says "BASH," I am, of course, not partial to it. Perl solutions are also welcome.

BZT
 

9 More Discussions You Might Find Interesting

1. Virtualization and Cloud Computing

Clouds (Partially Order Sets) - Streams (Linearly Ordered Sets) - Part 2

timbass Sat, 28 Jul 2007 10:07:53 +0000 Originally posted in Yahoo! CEP-Interest Here is my follow-up note on posets (partially ordered sets) and tosets (totally or linearly ordered sets) as background set theory for event processing, and in particular CEP and ESP. In my last note, we... (0 Replies)
Discussion started by: Linux Bot
0 Replies

2. Shell Programming and Scripting

Inserting Lines between data sets using SED?

Hello all and thanks in advance! What I'm looking to do is insert a blank line, anytime the first 9 characters of a given line don't match the first 9 characters of the previous line. i.e. Convert the data set 1 45 64 89 1 89 69 235 2 89 234 67 2 56 90... (1 Reply)
Discussion started by: selkirk
1 Replies

3. Solaris

Swap config - Mirror swap or not?

Hello and thanks in advance. I have a Sun box with raid 1 on the O/S disks using solaris svm. I want to unmirror my swap partition, and add the slice on the second disk as an additional swap device. This would give me twice as much swap space. I have been warned not to do this by some... (3 Replies)
Discussion started by: BG_JrAdmin
3 Replies

4. HP-UX

Swap device file and swap sapce

Hi I have an integrity machine rx7620 and rx8640 running hp-ux 11.31. I'm planning to fine tune the system: - I would like to know when does the memory swap space spill over to the device swap space? - And how much % of memory swap utilization should be specified (swap space device... (6 Replies)
Discussion started by: lamoul
6 Replies

5. UNIX for Advanced & Expert Users

Swap lines using sed

Hi, I have to swap two consecutive line using sed in a file. My text to swap is available in the file x.pl #Create & map a common work library if (!(-e "../work")) { system ("vlib work ../work"); system ("vmap work ../work"); } system ("vsimsa -do thiagu_dec.do"); In this i... (6 Replies)
Discussion started by: adharmalingam
6 Replies

6. Shell Programming and Scripting

How to swap order of pairs of lines?

This seems to be a question whose answer uses sed or awk. For a file like: a b c d e How to swap the order of the line pairs, to end up with: b a d c e All lines from the original file need to wind up in the output file. (8 Replies)
Discussion started by: rd5817
8 Replies

7. Shell Programming and Scripting

sed swap lines

Hi, I think it is possible with sed, but I'm not sure... I've a file that contains some text and filenames: gtk-media-pause | CB60471-05 - Gilbert, Brantley - Country Must Be Country Wide.zip | 8175 | /home/floris/Muziek/Karaoke/1341838939/CB60471-05 - Gilbert, Brantley - Country Must Be... (2 Replies)
Discussion started by: jkfloris
2 Replies

8. Shell Programming and Scripting

Search and swap multiple lines in file using Perl

Hi all, I have a vcd file with a bunch of lines containing an array, like this $var wire 1 b a $end $var wire 1 c a $end $var wire 1 d a $end $var wire 1 e a $end $var wire 1 f b $end $var wire 1 g b $end $var wire 1 h b $end $var wire 1 i b $end I want it like this: $var wire 1 e a... (12 Replies)
Discussion started by: veerabahu
12 Replies

9. Solaris

Explain the output of swap -s and swap -l

Hi Solaris Folks :), I need to calculate the swap usage on solaris server, please let me understand the output of below swap -s and swap -l commands. $swap -s total: 1774912k bytes allocated + 240616k reserved = 2015528k used, 14542512k available $swap -l swapfile dev swaplo... (6 Replies)
Discussion started by: seenuvasan1985
6 Replies
httppower(8)							     powerman							      httppower(8)

NAME
httppower - communicate with HTTP based power distribution units SYNOPSIS
httppower [--url URL] DESCRIPTION
httppower is a helper program for powerman which enables it to communicate with HTTP based power distribution units. It is run interac- tively by the powerman daemon. OPTIONS
-u, --url URL Set the base URL. INTERACTIVE COMMANDS
The following commands are accepted at the httppower> prompt: auth user:pass Authenticate to the base URL with specified user and password, using ``basic'' HTTP authentication which sends the user and password over the network in plain text. seturl URL Set the base URL. Overrides the command line option. get [URL-suffix] Send an HTTP GET to the base URL with the optional URL-suffix appended. post [URL-suffix] key=val[&key=val]... Send an HTTP POST to the base URL with the optional URL-suffix appended, and key-value pairs as argument. FILES
/usr/sbin/httppower /etc/powerman/powerman.conf ORIGIN
PowerMan was originally developed by Andrew Uselton on LLNL's Linux clusters. This software is open source and distributed under the terms of the GNU GPL. SEE ALSO
powerman(1), powermand(8), httppower(8), plmpower(8), vpcd(8), powerman.conf(5), powerman.dev(5), powerman-devices(7). http://sourceforge.net/projects/powerman powerman-2.3.5 2009-02-09 httppower(8)
All times are GMT -4. The time now is 10:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy