10-01-2018
In addition to what Neo has already said, it isn't at all clear what you are really trying to do. Since features vary from system to system and shell to shell, you should always tell us what operating system and shell you're using when starting a thread in the Shell Programming and Scripting forum. You haven't done that.
You haven't shown us what your original input looks like. If you're trying to rewrite your
awk script to produce the output you want instead of the current output you showed us in post #1 in this thread, we need to know details about your input file(s) format(s).
You haven't shown us the
awk script that produces your current output. If you want us to help you fix your code, we have to be able to see your code.
If you want to keep your current
awk script and write another shell,
sed,
awk, or some other utility or combination of utilities; we could do that, but it would be grossly inefficient and would seem to be fighting against your goal of directly producing the final output you want. Whether or not you have tried to write a script to reformat your current output and want to rewrite your script to format your output correctly to start with, we need to see what you have tried to achieve that goal so we have a better understanding of what you do understand and where you're stuck.
So, please help us help you by:
- telling us what operating system you're using,
- telling us what shell you're using,
- showing us the input data (in CODE tags) that was used by your awk script to produce the current output you have shown us and explain to us in English the format of that input data,
- showing us your awk script (in CODE tags) that processed the input data described above and produced the current output you have shown us,
- showing us code that you have tried (in CODE tags) to get the final output you are hoping to produce, and
- explaining to us where you are stuck.
This User Gave Thanks to Don Cragun For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi guys
Could anyone advise me how to convert my rows into columns from a file
My file would be similar to this:
A11 A12 A13 A14 A15 ... A1n
A21 A22 A23
A31
A41
A51
...
Am1 Am2 Am3 Am4 Am5 ... Amn
The number of rows is not the same to the number of columns
Thanks in advance (2 Replies)
Discussion started by: loperam
2 Replies
2. Shell Programming and Scripting
hi,
Apologies if this has been covered.
I have requirement where i have to convert a single column into multiple column.
My data will be like this -
2
3
4
5
6
Output required -
2 3 4 5 6 (1 Reply)
Discussion started by: Nishithinfy
1 Replies
3. Programming
I have few files which have two columns in each.
like
e2
1 1 2694
2 4 2485
3 2 2098
5 1 2079
6 5 2022
9 4 1734
11 5 1585
13 2 1461
18 1 1092
21 2 1019
24 1 915
25 3 907
27 1 891
28 3 890
34 1 748
39 1 700 (1 Reply)
Discussion started by: kamuju
1 Replies
4. UNIX for Dummies Questions & Answers
Hi , I am struck while coding AWK script. Need your help to convert rows into columns. I should copy only those rows which are marked to Y in a file and ignore N rows. Please help me find a solution.
input file
1|abc|Y
2|cdf|Y
3|efg|N
4|xyz|Y
my output should be something like this... (2 Replies)
Discussion started by: rashmisb
2 Replies
5. Shell Programming and Scripting
hi friends,
i am able to parse cvs diff file using bit of cut and grep commands to produce following output in text file
'''cvs-diff.txt'''
Package-Name = dev-freetype.
Old-Version = 2.4.8
New-Version = 2.4.10
Patches-removed = freetype-2.4.8-cross-compile.patch... (2 Replies)
Discussion started by: alexzander18
2 Replies
6. Shell Programming and Scripting
Hi Gurus,
How to convert rows in to columns using linux shell scripting
Input is like (sample.txt)
ABC
DEF
GHI
JKL
MNO
PQR
STU
VWX
YZA
BCD
output should be (sampleoutput.csv)
ABC,DEF,GHI,JKL,MNO
PQR,STU,VWX,YZA,BCD (2 Replies)
Discussion started by: infasriniit
2 Replies
7. UNIX for Dummies Questions & Answers
Hi guys!
I use AWK commands under GAMS to predispose the data files to be read by GAMS.
I have a file which contains groups of data I need. Unfortunately I have the data spread in 3 rows for each subject.
Here's an example (the file is really long)
1 0 2.0956 100.00 250.00 100.00 2.0956... (4 Replies)
Discussion started by: Pintug
4 Replies
8. Shell Programming and Scripting
Hi Everyone,
Could someone shed some lights on how to convert the records in rows form into column basis.
172.29.59.12
IBM,8255-E8B
102691P
8
65536 MB
6100-04-11-1140
172.29.59.15
IBM,8255-E8B
102698P
4
45056 MB
6100-04-11-1140
IP SYS MODEL ... (6 Replies)
Discussion started by: ckwan
6 Replies
9. Shell Programming and Scripting
I am looking to print the data in columns and after every 3 words it should be a new row.
cat example.out | awk 'END { for (i = 0; ++i < m;) print _;print _ }{ _ = _ x ? _ OFS $1 : $1}' m=1| grep -i INNER
I am looking to print in a new line after every 3 words.
... (2 Replies)
Discussion started by: lazydev
2 Replies
10. Shell Programming and Scripting
hi folks,
I have a sample data like what is shown below:
1,ID=1000
1,Org=CedarparkHospital
1,cn=john
1,sn=doe
1,uid=User001
2,uid=User002
2,ID=2000
2,cn=steve
2,sn=jobs
2,Org=Providence
I would like to convert it into the below format:
1,1000,CedarparkHospital,john,doe,User001... (11 Replies)
Discussion started by: vskr72
11 Replies
trbdf(1) User Manuals trbdf(1)
NAME
trbdf - convert BDF-font from one encoding to other
SYNOPSIS
trbdf -C | -l | -h
trbdf [-s] [-f input-codeset ] [-t output-codeset ] [--foundry[=] new-foundry ] BDF-font
DESCRIPTION
trbdf is a program for translation of BDF fonts from one encoding to other. One exciting feature of trbdf is that it tries to approximate
the symbols that miss from the font or from the encoding of the font with existing symbols when possible.
If the option -s or --gen-script is given trbdf will generate an awk(1) script for translation of BDF-fonts for fixed combination of input-
codeset and output-codeset This is useful for faster convertion of many files. This script is used as filter.
If none of -C, -s, -l, -h and their equivalents is given the BDF-font will be read assuming it is coded with codeset input-codeset On stan-
dard output it will be recoded so to use codeset output-codeset Both input-codeset and output-codeset are case insensitive and default to
`cp1251'.
OPTIONS
-C, --copyright
Display copying conditions and warranty information.
-s, --gen-script
Generates conversion script for given input and output encodings instead to convert BDF-font. This option is usefull if you have to
convert many fonts. The generated script expects the input font from its standard input and outputs the converted font.
-l, --list
List all known codesets.
-h, --help
Display this help and exit.
-f input-codeset, --from[=]input-codeset
Codeset of the source font.
-f output-codeset, --to[=]output-codeset
Codeset of the generated font.
--foundry[=]new-foundry
Use this option if you want to change the foundry of the generated fonts.
AUTHOR
Anton Zinoviev <anton@lml.bas.bg>, <zinoviev@fmi.uni-sofia.bg>
SEE ALSO
bdftopcf(1x)
trscripts NOV 2002 trbdf(1)