Combining chunks of data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Combining chunks of data
# 8  
Old 08-13-2012
sorry for interpreting output wrongly try this
Code:
awk 'BEGIN{f=1;i=1}{if(length($0)==0){f=0;k=1;next};if(f==1){a[i]=$1;i++}else{if(f==0&&k<i){print a[k],$1;k++}else{f=1;i=1}}}' inputfile

# 9  
Old 08-13-2012
Code:
awk '{
n=split($0,b,RS)
for(i=1;i<=n;i++)
 a[i]=a[i]?a[i]b[i]:b[i]
}
END {
for(i=1;a[i];i++)
 print a[i]
}' RS= infile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Move files from one directory to another in chunks

All, I have an application that is not working properly and the company is 'in the process' of fixing it. In the meantime, I want to write a bash script work-around. However, what I thought was going to be simple is seemingly not. Need: - Move files from one directory to another in... (3 Replies)
Discussion started by: hburnswell
3 Replies

2. Red Hat

Free() corrupted unsorted chunks

We are migrating Pro*C code from SOLARIS to LINUX-Redhat. While migrating we face memory de-allocation issue intermittently when accessing large volume of data. Below is the part of the code(since code is big I am putting the part of the code where the issue comes): ... (8 Replies)
Discussion started by: Karunx
8 Replies

3. Shell Programming and Scripting

Splitting a file into chunks of 1TB

Hi I have a file with different filesystems with there sizes. I need to split them in chucks of 1TB. The file looks like vf_MTLHQNASF07_Wkgp2 187428400 10601AW1 vf_MTLHQNASF07_Wkgp2 479504596 10604AW1 vf_MTLHQNASF07_Wkgp2 19940 10605AID vf_MTLHQNASF07_Wkgp2 1242622044... (4 Replies)
Discussion started by: bombcan
4 Replies

4. UNIX for Dummies Questions & Answers

Need help combining txt files w/ multiple lines into csv single cell - also need data merge

:confused:Hello -- i just joined the forums. I am a complete noob -- only about 1 week into learning how to program anything... and starting with linux. I am working in Linux terminal. I have a folder with a bunch of txt files. Each file has several lines of html code. I want to combine... (2 Replies)
Discussion started by: jetsetter
2 Replies

5. Shell Programming and Scripting

onstat -d chunks perl monitor

I have a file I need to monitor with a perl script with the following format. I need to send off a 0 if it is above 95 in the 5th colum and a 1 if it is below. Any help on a simple perl script would be great. 75424958 999975 983170 /dev/rmetrochunk00 98.32 760c2dd8 ... (3 Replies)
Discussion started by: jlaigo2
3 Replies

6. Shell Programming and Scripting

Combining data from file

Hi All, I have file f1 contains : f1; Server Name1 te-1212hdsfhf-12kll-56565 Server Name2 jd-1212hdsfhf-12kll-5677 Server Name3 ty-1212hdsfhf-12kll-444 .... I have to produce f2 with the output: f2: Server1 te-1212hdsfhf-12kll-56565 Server2 jd-1212hdsfhf-12kll-5677 Server3... (11 Replies)
Discussion started by: krsnadasa
11 Replies

7. Shell Programming and Scripting

Parsing chunks of text and finding data

Hi, I need a script that parses and greps data out of a textfile. I have a text file that has this structure: File1 host1.localdomain text random text Found errors this text is random (41123) --- random random at.5165 ---- random random at.5165 ---- random random at.5165 ----... (2 Replies)
Discussion started by: erick_tuk
2 Replies

8. Shell Programming and Scripting

Combining header and data and send email without usage of temp file

Dear All- My requirement is as below- Header file $ cat HEADER.txt RequestId: RequestDate: Data file $ cat DATAVAL.txt 1001|2009-03-01 I need to send the combined data below as email body via mailx command ------------------ RequestId:1001 RequestDate:2009-03-01 I would like... (4 Replies)
Discussion started by: sureshg_sampat
4 Replies

9. Shell Programming and Scripting

remove chunks of text from file

All, So, I have an ldif file that contains about 6500 users worth of data. Some users have a block of text I'd like to remove, while some don't. Example (block of text in question is the block starting with "authAuthority: ;Kerberosv5"): User with text block: # username, users,... (7 Replies)
Discussion started by: staze
7 Replies

10. Shell Programming and Scripting

Compare two csv files by two colums and create third file combining data from them.

I've got two large csv text table files with different number of columns each. I have to compare them based on first two columns and create resulting file that would in case of matched first two columns include all values from first one and all values (except first two colums) from second one. I... (5 Replies)
Discussion started by: agb2008
5 Replies
Login or Register to Ask a Question