Column to row and position data in a text file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Column to row and position data in a text file
# 8  
Old 10-11-2017
Just another idea for fun...
Code:
set -- $( xargs -n2 <yourfile | sed 's/ .*//' | xargs )
echo -e "$7,$8,ZZZZZZ\n$1,$4\n$2,$5\n$3,$6\n"

(to be adapted )
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print every alternate column in row in a text file

Hi, I have a comma separated file. I would like to print every alternate columns into a new row. Example input file: Name : John, Age : 30, DOB : 30-Oct-2018 Example output: Name,Age,DOB John,30,30-Oct-2018 (3 Replies)
Discussion started by: Lini
3 Replies

2. UNIX for Dummies Questions & Answers

awk to print first row with forth column and last row with fifth column in each file

file with this content awk 'NR==1 {print $4} && NR==2 {print $5}' file The error is shown with syntax error; what can be done (4 Replies)
Discussion started by: cdfd123
4 Replies

3. UNIX for Dummies Questions & Answers

Adding a column to a text file with row numbers

Hi, I would like to add a new column containing the row numbers to a text file. How do I go about doing that? Thanks! Example input: A X B Y C D Output: A X 1 B Y 2 C D 3 (5 Replies)
Discussion started by: evelibertine
5 Replies

4. UNIX for Advanced & Expert Users

Convert column data to row data using shell script

Hi, I want to convert a 3-column data to 3-row data using shell script. Any suggestion in this regard is highly appreciated. Thanks. (4 Replies)
Discussion started by: sktkpl
4 Replies

5. Shell Programming and Scripting

Sort a the file & refine data column & row format

cat file1.txt field1 "user1": field2:"data-cde" field3:"data-pqr" field4:"data-mno" field1 "user1": field2:"data-dcb" field3:"data-mxz" field4:"data-zul" field1 "user2": field2:"data-cqz" field3:"data-xoq" field4:"data-pos" Now i need to have the date like below. i have just... (7 Replies)
Discussion started by: ckaramsetty
7 Replies

6. UNIX for Dummies Questions & Answers

How do you delete cells from a space delimited text file given row and column number?

How do you delete cells from a space delimited text file given row and column number? Letś say the row number is r and the column number is c. Thanks! (5 Replies)
Discussion started by: evelibertine
5 Replies

7. Shell Programming and Scripting

Moving data from a specified column/row to another column/row

Hello, I have an input file like the following: 11_3_4 2_1_35 3_15__ _16989 Where '_' is a space. The data is in a table. Is there a way for the program to prompt the user for x1,y1 and x2,y2, where x1,y1 is the desired number (for example x=6 y=4 is a value of 4) and move to a desired spot... (2 Replies)
Discussion started by: jl487
2 Replies

8. Shell Programming and Scripting

row to column and position data in to fixed column width

Dear friends, Below is my program and current output. I wish to have 3 or 4 column output in order to accomodate in single page. i do have subsequent command to process after user enter the number. Program COUNT=1 for MYDIR in `ls /` do VOBS=${MYDIR} echo "${COUNT}. ${MYDIR}" ... (4 Replies)
Discussion started by: baluchen
4 Replies

9. Shell Programming and Scripting

Convert row data to column data

Hi Guys, I have a file as follows: a 1 b 786 c 90709 d 99 a 9875 b 989 c 887 d 111 I want: a 1 9875 b 786 989 (3 Replies)
Discussion started by: npatwardhan
3 Replies

10. Shell Programming and Scripting

Changing the column for a row in a text file and adding another row

Hi, I want to write a shell script which increments a particular column in a row from a text file and then adds another row below the current row with the incremented value . For Eg . if the input file has a row : abc xyz lmn 89 lm nk o p I would like the script to create something like... (9 Replies)
Discussion started by: aYankeeFan
9 Replies
Login or Register to Ask a Question
erl_comment_scan(3erl)					     Erlang Module Definition					    erl_comment_scan(3erl)

NAME
erl_comment_scan - Functions for reading comment lines from Erlang source code. DESCRIPTION
Functions for reading comment lines from Erlang source code. DATA TYPES
comment() = {integer(), integer(), integer(), [string()]} : EXPORTS
file(FileName::filename() (see module file)) -> [Comment] Types Comment = {Line, Column, Indentation, Text} Line = integer() Column = integer() Indentation = integer() Text = [string()] Extracts comments from an Erlang source code file. Returns a list of entries representing multi-line comments, listed in order of increasing line-numbers. For each entry, Text is a list of strings representing the consecutive comment lines in top-down order; the strings contain all characters following (but not including) the first comment-introducing % character on the line, up to (but not including) the line-terminating newline. Furthermore, Line is the line number and Column the left column of the comment (i.e., the column of the comment-introducing % char- acter). Indent is the indentation (or padding), measured in character positions between the last non-whitespace character before the comment (or the left margin), and the left column of the comment. Line and Column are always positive integers, and Indentation is a nonnegative integer. Evaluation exits with reason {read, Reason} if a read error occurred, where Reason is an atom corresponding to a Posix error code; see the module file(3erl) for details. join_lines(Lines::[CommentLine]) -> [Comment] Types CommentLine = {Line, Column, Indent, string()} Line = integer() Column = integer() Indent = integer() Comment = {Line, Column, Indent, Text} Text = [string()] Joins individual comment lines into multi-line comments. The input is a list of entries representing individual comment lines, in order of decreasing line-numbers ; see scan_lines/1 for details. The result is a list of entries representing multi-line comments, still listed in order of decreasing line-numbers , but where for each entry, Text is a list of consecutive comment lines in order of increasing line-numbers (i.e., top-down). See also: scan_lines/1 . scan_lines(Text::string()) -> [CommentLine] Types CommentLine = {Line, Column, Indent, Text} Line = integer() Column = integer() Indent = integer() Text = string() Extracts individual comment lines from a source code string. Returns a list of comment lines found in the text, listed in order of decreasing line-numbers, i.e., the last comment line in the input is first in the resulting list. Text is a single string, contain- ing all characters following (but not including) the first comment-introducing % character on the line, up to (but not including) the line-terminating newline. For details on Line , Column and Indent , see file/1 . string(Text::string()) -> [Comment] Types Comment = {Line, Column, Indentation, Text} Line = integer() Column = integer() Indentation = integer() Text = [string()] Extracts comments from a string containing Erlang source code. Except for reading directly from a string, the behaviour is the same as for file/1 . See also: file/1 . AUTHORS
Richard Carlsson <richardc@it.uu.se > syntax_tools 1.6.7 erl_comment_scan(3erl)