Transpose info that is within blocks


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Transpose info that is within blocks
# 15  
Old 03-26-2012
No that won't work. The first awk is to clean empty lines so that they are only empty lines. It is to be completed before the file is read a second time to determine where a record starts and where it ends. RS= separates on the basis of two or more consecutive newlines. I do not understand why that would not work. Only prints the headers, what headers do you mean?
The "$1" inside the shell script is the first parameter on the command line of the script (for example Script.sh). So ./Script.sh inputfile > output would make "$1" inside the script equal to "inputfile" .
# 16  
Old 03-26-2012
I've tested again, I realized that I was sending in wrong way the script, you've clarified with you example. Thank you it works now!!!

I meant the headers defined in BEGIN{} statement.

A question.

The way the script works now "./Script.sh inputfile > output" becomes in a executable script or not, if not how would be executable and how would be the way to execute it?

Many thanks, I think that must be the lasts questions, I've learned several new things with your answers and algorithm. Many thanks.

Regards
# 17  
Old 03-27-2012
Hi, to make a script executable, have a look at man chmod
This User Gave Thanks to Scrutinizer For This Post:
# 18  
Old 03-28-2012
Hello Scrutinizer,

Thanks for your answer and all your help in my thread.

Much appreciated.

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Blocks into table

please help, I have a huge file with blocks of data which I need to convert to a tabular format. Input sample id: GO:0000017 name: alpha-glucoside transport namespace: biological_process def: "The directed movement of alpha-glucosides into, out of or within a cell, or between... (3 Replies)
Discussion started by: ritakadm
3 Replies

2. Shell Programming and Scripting

Row blocks to column blocks

Hello, Searched for a while and found some "line-to-column" script. My case is similar but with multiple fields each row: S02 Length Per S02 7043 3.864 S02 54477 29.89 S02 104841 57.52 S03 Length Per S03 1150 0.835 S03 1321 0.96 S03 ... (9 Replies)
Discussion started by: yifangt
9 Replies

3. Shell Programming and Scripting

Transpose lines from individual blocks to unique lines

Hello to all, happy new year 2013! May somebody could help me, is about a very similar problem to the problem I've posted here where the member rdrtx1 and bipinajith helped me a lot. https://www.unix.com/shell-programming-scripting/211147-map-values-blocks-single-line-2.html It is very... (3 Replies)
Discussion started by: Ophiuchus
3 Replies

4. Shell Programming and Scripting

how to split this file into blocks and then send these blocks as input to the tool called Yices?

Hello, I have a file like this: FILE.TXT: (define argc :: int) (assert ( > argc 1)) (assert ( = argc 1)) <check> # (define c :: float) (assert ( > c 0)) (assert ( = c 0)) <check> # now, i want to separate each block('#' is the delimeter), make them separate files, and then send them as... (5 Replies)
Discussion started by: paramad
5 Replies

5. UNIX for Dummies Questions & Answers

Convert 512-blocks to 4k blocks

I'm Unix. I'm looking at "df" on Unix now and below is an example. It's lists the filesystems out in 512-blocks, I need this in 4k blocks. Is there a way to do this in Unix or do I manually convert and how? So for container 1 there is 7,340,032 in size in 512-blocks. What would the 4k block be... (2 Replies)
Discussion started by: rockycj
2 Replies

6. Shell Programming and Scripting

Help with Script using Command Blocks

Hello, I am trying to create a shell script that use command block (donīt really know if this is the correct way to say it), but while one version works fine, the other one is not working at all. So let me show an example of this "command block" Iīm using and its working ok: cat << _EOF_ `echo... (7 Replies)
Discussion started by: Alexis Duarte
7 Replies

7. Shell Programming and Scripting

Removing blocks from a file

I have a file like the one below. Each record is separated with > In between I have lines consisting of 3 numeric values separated by a space. I need to take each block between the > sign and read the first number in the line. Then take the first after the > sign and the last before the >... (7 Replies)
Discussion started by: kristinu
7 Replies

8. Shell Programming and Scripting

How to read text in blocks

Hi, I have file which contains information written in blocks (every block is different). Is it possible to read every block one by one to another file (one block per file). The input is something like this <block1> <empty line> <block2> <empty line> ... ... ... <block25> <empty... (0 Replies)
Discussion started by: art84_)LV
0 Replies

9. Shell Programming and Scripting

Delete blocks with no data..

Hi, I tried this but could not get it... here is what I need I have an xml where I get all the data in blocks but some times I get empty blocks with no data...shown below..I need to delete only those blocks with no data, I tried couple of ways but could not do it..any help is appreciated...... (1 Reply)
Discussion started by: mgirinath
1 Replies
Login or Register to Ask a Question