12-29-2017
As has been suggested before, when posting in this forum please tell us what operating system and shell you're using.
And, instead of just showing us a three line sample input file and a three line sample output file, please also describe the logic that governs the changes you are trying to make.
The code you're using is going to a lot of effort to remove braces from the output, but since there aren't any braces in your sample input; it isn't clear why you are doing that.
The code you're using sets the output field separator to a comma, but your sample output seems to use semicolon as a field separator.
Please clearly explain what you are trying to do and be sure that the sample output you have provided really matches the output you hope to produce from that input.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Let's say I write a simple script that contains the following:
date | awk '{print $1}'
date | awk '{print $2}'
Of course, when I run the script the output will look similar to:
Tue
Mar
What if I want my ouput to be on one line as follows:
Tue Mar
What changes would I need to... (2 Replies)
Discussion started by: cdunavent
2 Replies
2. Shell Programming and Scripting
Hello - is there any way in awk I can do...
4861 x(1) y(1) z(1)
4959 x(1) y(1) z(1)
5007 x(1) y(1) z(1)
4861 x(2) y(2) z(2)
4959 x(2) y(2) z(2)
5007 x(2) y(2) z(2)
4861 x(3) y(3) z(3)
4959 x(3) y(3) z(3)
5007 x(3) y(3) z(3)
to become...
4861 x(1) y(1) z(1) 4861 x(2) y(2) z(2)... (3 Replies)
Discussion started by: catwoman
3 Replies
3. UNIX for Advanced & Expert Users
I have a file in CSV format (2 columns ID and Number of Items):
AB1 ,,10
AB2 ,,20
AB2 ,, 30
AB3 ,, 10
AB4 ,, 20
AB4 ,, 30
AB4 ,, 40
AB5 ,, 50
AB6 ,, 10
AB7 ,, 20
AB7 ,, 30
AB7 ,, 40
......
This file is produced daily i would like to get it in the following format, so... (6 Replies)
Discussion started by: SAMZ
6 Replies
4. Shell Programming and Scripting
Hi,
I have a (quite large) data file which looks like:
_____________
header part..
more header part..
x1 x2 x3 x4 x5 x6
x7 x8 x9 x10 x11 x12
x13 ...
... x59 x60
y1 y2 y3 y4...
... y100
______________
where x1, x2,...,x60 and y1, y2,...y100 are numbers of 10 digits (so each line... (5 Replies)
Discussion started by: lego
5 Replies
5. Shell Programming and Scripting
Hi,
I need to insert a line at a particular line number. I am using the below code:
sed $REV_LINO_NO" i\\
# $CURRENT_DATE $NAME Changed pwd for cindy\'s id" file > file1
This code works, but the formatting is not as I expected. For example, I get lines as shown below... (2 Replies)
Discussion started by: sugan
2 Replies
6. Shell Programming and Scripting
Dear all
I require help with AWK regarding this situation
Input is :
fn1 12345
fn1 23456
fn3 231513
fn1 22325
fn3 123125
Desired output is
fn1 12345 23456 22325
fn3 231513 123125 (5 Replies)
Discussion started by: Peasant
5 Replies
7. Shell Programming and Scripting
when i try this awk its giving out put as below.
awk '!(/^$/||/--/||/selected/||/^ *$/){print $1}' tmp.txt
output
=====
1
2010-08-03-12.31.26.126000
how excluede the 1st line ? i mean i want output only 2nd line i.e 2010-08-03-12.31.26.126000; (5 Replies)
Discussion started by: rocking77
5 Replies
8. UNIX for Dummies Questions & Answers
Hi all,
I'm writing a simple awk code:
awk 'BEGIN {FS="|"};{print "Type\tNumber\ttypes\tTotal";};{print $1, "\t", $2, "\t", $3, "\t", $4, "\t";}' db_query.txt
it gives me the result:
Type Number types Total
XXX 498.0 5100.0 5274.661
Type Number types Total... (7 Replies)
Discussion started by: messi777
7 Replies
9. Shell Programming and Scripting
Hi All,
Need an urgent help to convert a unix file in to a particular format:
**source file:**
1111111
2d2f2h2
3dfgsd3
...........
1111111 <-- repeats in every nth line. remaining all lines will be different
123ss41
432ff45
...........
1111111 <-- repetition
qwe1234
123weq3... (1 Reply)
Discussion started by: rajivnairfis
1 Replies
10. UNIX for Dummies Questions & Answers
Hi,
I have a file below that I am wanting to awk. The lines of relevance are lines 7 and 9
$ nl /tmp/x
1 ADRCI: Release 11.2.0.3.0 - Production on Sun Jun 23 17:01:02 2013
2 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
3 ADR base =... (2 Replies)
Discussion started by: newbie_01
2 Replies
LEARN ABOUT SUSE
esdsample
esdsample(1) User Commands esdsample(1)
NAME
esdsample - play a sample
SYNOPSIS
esdsample [-s hostname:port] [-b] [-d] [-e] [-h] [-m] [-r freq] samplename
DESCRIPTION
The esdsample utility plays a sample using the Enlighted Sound Daemon (esd).
OPTIONS
The following options are supported:
-s hostname:portContact the esd server on hostname at port.
-b Specify that the output should be in 8-bit format. By default, the output is in 16-bit format.
-d Play the sample from file as raw data. The default behavior is to read the data from a sound file (.wav, .au, and so on).
If this option is chosen, samplename is the name of a file.
-e Play the sample from the esd cache. If this option is chosen, samplename is the name of the sample in the cache.
-h Display help text, and exit.
-m Specify that the output should be in mono format. By default, the output is in stereo format.
-r freq Specify that the output rate should be set to freq. By default, the output rate is set to 44.1 kHz.
OPERANDS
The following operands are supported:
samplename The name of the sample to be played. If the -e option is used, samplename is the esd cache name. Otherwise, samplename is
a filename.
EXAMPLES
Example 1: Playing a sample from a file
example% esdsample generic.wav
Example 2: Playing a sample from the esd cache
example% esdsample -e esdctl:generic.wav
(where esdctl:generic.wav is the cache name)
EXIT STATUS
The following exit values are returned:
0 Application exited successfully
>0 Application exited with failure
FILES
The following files are used by this application:
/usr/bin/esdsample Executable for Enlightened Sound Daemon sound sampler.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWgnome-audio |
+-----------------------------+-----------------------------+
|Interface stability |External |
+-----------------------------+-----------------------------+
SEE ALSO
esdcat(1), esdmon(1), esdplay(1), esdrec(1), esdctl(1), esd-config(1), libesd(3)
NOTES
Written by Brian Cameron, Sun Microsystems Inc., 2003.
SunOS 5.10 8 Jan 2003 esdsample(1)