Sponsored Content
Top Forums Shell Programming and Scripting Help to data re-arrangement problem Post 302544526 by cpp_beginner on Thursday 4th of August 2011 04:59:02 AM
Old 08-04-2011
Help to data re-arrangement problem

Input file
Code:
<data id>="1">\
</data>\
<data id>="2">\
</data>\
<code>="1" target="2">\
</code>\
<data id>="1">\
</data>\
<data id>="2">\
</data>\
<code>="1" target="2">\
</code>\
<data id>="1">\
</data>\
<data id>="2">\
</data>\
<code>="1" target="2">\
</code>\
.
.

Desired output result:
Code:
<data id>="1">\
</data>\
<data id>="2">\
</data>\
<code>="1" target="2">\
</code>\
<data id>="3">\
</data>\
<data id>="4">\
</data>\
<code>="3" target="4">\
</code>\
<data id>="5">\
</data>\
<data id>="6">\
</data>\
<code>="5" target="6">\
</code>\

My input file is only "1" and "2".
However, those "data id" and "code" in my desired output result should be descending order until end up the file.

Thanks for any advice.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Text file arrangement

Dear UNIX experts: Hi, I have a text file which the contents are arranged vertically down, line by line. How do use a loop (I think) to make it arrange in vertical arrangement with a tab delimitated and write to a new file? Eg: of source file Hello World Good-day Thanks Welcome The... (8 Replies)
Discussion started by: merry susana
8 Replies

2. UNIX for Dummies Questions & Answers

Data arrangement

I have these following data: Home Tom Member List 100 Yes 200 No Home Tom Member List 1 No 2 Yes Home Tome Member List 3 No 400 Yes I want my data to be consistants like this: (4 Replies)
Discussion started by: bobo
4 Replies

3. UNIX for Dummies Questions & Answers

Cell arrangement

I have a data file with hundreds of lines: I want to place a YES right below the line that say mydata....can someone please help! on the left is my the original data on the right the data format need to be: left > Right mydata > mydata yes > yesno > no mydata > mydata... (12 Replies)
Discussion started by: bobo
12 Replies

4. UNIX for Dummies Questions & Answers

Data arrangement

10 2 1 2 3 4 5 6 7 8 20 3 2 1 3 2 9 8 2 1 Need the data to be arranged: 10 2 1 5 2 6 3 7 4 8 20 3 2 1 1 2 3 8 2 9 please help! (6 Replies)
Discussion started by: bobo
6 Replies

5. UNIX for Dummies Questions & Answers

Help on file arrangement

Can anyone help me on this. I have a file that looks like this: color red green blue color pink yellow number one two gender male gender female The output would look like this: color red green blue pink yellow number one two gender male female I have over 5000 rows and i dont want... (5 Replies)
Discussion started by: kharen11
5 Replies

6. Shell Programming and Scripting

sorting/arrangement problem

Hi, I have the following 'sorting' problem. Given the input file: a:b:c:12:x:k s:m:d:8:z:m a:b:c:1:x:k p:q:r:23:y:m a:b:c:3:x:k p:q:r:1:y:m the output I expect is: a:b:c:1:x:k p:q:r:1:y:m s:m:d:8:z:m What happened here is I grouped together lines having the same values for... (7 Replies)
Discussion started by: Abhishek Ghose
7 Replies

7. Shell Programming and Scripting

Re-arrangement of data

Dear Frineds, I have a flat file as follows ABCD ABDCWQE POIERAS ADSGASGFG GHJKFHD XBDFGHFGDH POIU IJPFG AFGJFPGOU A;DGUPGU SFSDFDSDFHDSF SDFGHSFDH I want this column to be converted into row like follows ABCD, ABDCWQE, POIERAS, ADSGASGFG, GHJKFHD, XBDFGHFGDH (6 Replies)
Discussion started by: anushree.a
6 Replies

8. Shell Programming and Scripting

Help with data re-arrangement problem facing

Input file: <symbol>Q9Y8G1</symbol> <name>Q9Y8G1_EMENI</name> <symbol>Q6V953</symbol> <symbol>Q5B8K1</symbol> <name>Q6V953_EMENI</name> <symbol>G1A416</symbol> <name>G1A416_9FUNG</name> <symbol>D4N894</symbol> <name>D4N894_PLEER</name> <symbol>B0FFU4</symbol>... (13 Replies)
Discussion started by: cpp_beginner
13 Replies

9. UNIX for Advanced & Expert Users

Data re-arrangement

Hi I have a huge problem to solve ASAP. Can someone please help!!! My format is arranged in this format: It has three columns. LOGIN ALIAS REC_ID A BB1 0 A ... (1 Reply)
Discussion started by: Mapilo
1 Replies

10. Shell Programming and Scripting

Retreive data with arrangement

Hi all I have following part of a big file TTDS00002 Synonyms M1 receptor TTDS00002 Disease Alzheimer's disease TTDS00002 Disease Bronchospasm (histamine induced) TTDS00002 Disease Cognitive deficits TTDS00002 Disease Schizophrenia TTDS00002 Function The muscarinic acetylcholine... (2 Replies)
Discussion started by: kareena
2 Replies
atomic_inc(3C)															    atomic_inc(3C)

NAME
atomic_inc, atomic_inc_8, atomic_inc_uchar, atomic_inc_16, atomic_inc_ushort, atomic_inc_32, atomic_inc_uint, atomic_inc_ulong, atomic_inc_64, atomic_inc_ptr, atomic_inc_8_nv, atomic_inc_uchar_nv, atomic_inc_16_nv, atomic_inc_ushort_nv, atomic_inc_32_nv, atomic_inc_uint_nv, atomic_inc_ulong_nv, atomic_inc_64_nv, atomic_inc_ptr_nv - atomic inrement operations SYNOPSIS
#include <atomic.h> void atomic_inc_8(volatile uint8_t *target); void atomic_inc_uchar(volatile uchar_t *target); void atomic_inc_16(volatile uint16_t *target); void atomic_inc_ushort(volatile ushort_t *target); void atomic_inc_32(volatile uint32_t *target); void atomic_inc_uint(volatile uint_t *target); void atomic_inc_ulong(volatile ulong_t *target); void atomic_inc_64(volatile uint64_t *target); void atomic_inc_ptr(volatile void *target); uint8_t atomic_inc_8_nv(volatile uint8_t *target); uchar_t atomic_inc_uchar_nv(volatile uchar_t *target); uint16_t atomic_inc_16_nv(volatile uint16_t *target); ushort_t atomic_inc_ushort_nv(volatile ushort_t *target); uint32_t atomic_inc_32_nv(volatile uint32_t *target); uint_t atomic_inc_uint_nv(volatile uint_t *target); ulong_t atomic_inc_ulong_nv(volatile ulong_t *target); uint64_t atomic_inc_64_nv(volatile uint64_t *target); void *atomic_inc_ptr_nv(volatile void *target); These functions enable the inrementing (by one) of the value stored in target to occur in an atomic manner. The *_nv() variants of these functions return the new value of target. No errors are defined. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ atomic_add(3C), atomic_and(3C), atomic_bits(3C), atomic_cas(3C), atomic_dec(3C), atomic_or(3C), atomic_swap(3C), membar_ops(3C), attributes(5), atomic_ops(9F) The *_nv() variants are substantially more expensive on some platforms than the versions that do not return values. Do not use them unless you need to know the new value atomically. 13 May 2005 atomic_inc(3C)
All times are GMT -4. The time now is 09:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy