Sponsored Content
Top Forums Shell Programming and Scripting Awk concatenation in different lines Post 302433175 by posner on Monday 28th of June 2010 10:09:19 PM
Old 06-28-2010
Thanks dude Scrutinizer

ur script worked perfect

i forgot to some information in the post like
the data can also as

id-number 01
name-id x0 input-id x0 output-id x0
name-id x0 input-id x0 output-id x0
name-id x0 input-id x0 output-id x0

id-number 02
name-id x0 input-id x0 output-id x0
name-id x0 input-id x0 output-id x0
name-id x0 input-id x0 output-id x0

id-number 03

id-number 04
name-id x0 input-id x0 output-id x0
name-id x0 input-id x0 output-id x0
.
.
id-number 03 doesn't have any info for itself but it should not be deleted the
the output must be like this


id-number 01 name-id x0 input-id x0 output-id x0
id-number 01 name-id x0 input-id x0 output-id x0
id-number 01 name-id x0 input-id x0 output-id x0

id-number 02 name-id x0 input-id x0 output-id x0
id-number 02 name-id x0 input-id x0 output-id x0
id-number 02 name-id x0 input-id x0 output-id x0

id-number 03

id-number 04 name-id x0 input-id x0 output-id x0
id-number 04 name-id x0 input-id x0 output-id x0

thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cannot get logic for concatenation awk

Hello friends, I have a problem in printing an array.. Example if my array line contains 4 elements like following line=0002 , line=202200, line=200002, line= 300313 Now one = sprintf line line line line will concatenate my whole array to one. But I am not sure about the... (7 Replies)
Discussion started by: user_prady
7 Replies

2. Shell Programming and Scripting

Sed/awk to delete single lines that aren't touching other lines

Hello, I'm trying to figure out how to use sed or awk to delete single lines in a file. By single, I mean lines that are not touching any other lines (just one line with white space above and below). Example: one two three four five six seven eight I want it to look like: (6 Replies)
Discussion started by: slimjbe
6 Replies

3. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum using sed, awk

Hi friends, This is sed & awk type question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example ###start of input text file #### abc def ghi 1 2 3 4 kjld random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies

4. UNIX for Dummies Questions & Answers

awk for concatenation of column values

Hello, I have a table as shown below. I want to concatenate values in col2 and col3 based on a value in col4. 1 X Y A 3 Y Z B 4 A W B 5 T W A If col4 is A, then I want to concatenate col3 with itself. Otherwise it should concateneate col2 with col3. 1 X Y YY 3 Y Z YZ... (10 Replies)
Discussion started by: Gussifinknottle
10 Replies

5. Shell Programming and Scripting

Concatenation in awk not working

Hello I want to achieve the following. However the concatenation is not working mv `ls -ltr *myfile*.log|awk '{print $9}'` `ls -ltr *myfile*.log|awk '{print `date +'%d%m%y%k%M%S'` $9}'` I tried awk '{x=`date +'%d%m%y%k%M%S'` print $x "" $9}' awk '{x=`date +'%d%m%y%k%M%S'`... (2 Replies)
Discussion started by: Chetanz
2 Replies

6. UNIX for Dummies Questions & Answers

awk - (URGENT!) Print lines sort and move lines if match found

URGENT HELP IS NEEDED!! I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but - Currently, script is not printing lines to File3.txt in order. - Also the matching lines are not moving out of File1.txt ... (1 Reply)
Discussion started by: High-T
1 Replies

7. Shell Programming and Scripting

Issue in Concatenation/Joining of lines in a dynamically generated file

Hi, I have a file containing many records delimited by pipe (|). Each record should contain 17 columnns/fields. there are some fields having fields less than 17.So i am extracting those records to a file using the below command awk 'BEGIN {FS="|"} NF !=17 {print}' feedfile.txt... (8 Replies)
Discussion started by: TomG
8 Replies

8. Shell Programming and Scripting

Merging multiple lines to columns with awk, while inserting commas for missing lines

Hello all, I have a large csv file where there are four types of rows I need to merge into one row per person, where there is a column for each possible code / type of row, even if that code/row isn't there for that person. In the csv, a person may be listed from one to four times... (9 Replies)
Discussion started by: RalphNY
9 Replies

9. Shell Programming and Scripting

awk concatenation issue - SQL generation

Greetings Experts, I have an excel file and I am unable to read it directly into awk (contains , " etc); So, I cleansed and copied the data into notepad. I need to generate a script that generates the SQL. Requirement: 1. Filter and select only the data that has the "mapping" as "direct"... (4 Replies)
Discussion started by: chill3chee
4 Replies

10. Shell Programming and Scripting

Concatenation lines based on first field of the lines

Hello All, This is to request some assistance on the issue that I encountered until recently. Problem is: I have a pipe delimited file in which some lines/records are broken. Now, I have to join/concatenate broken lines in the file to form actual record to make sure that the count of records... (8 Replies)
Discussion started by: svks1985
8 Replies
PCP(9.1)																  PCP(9.1)

NAME
pcp - copy pictures SYNOPSIS
fb/pcp [ -wx0 y0 x1 y1 ] [ -ox y ] [ -ttype ] [ -cchannels ] [ -Cchannels ] [ -mcolormap ] [ -M ] [ input [ output ] ] DESCRIPTION
Pcp copies the input picture (default standard input) to the output file (default standard output). Options control the attributes and content of the output picture. -w x0 y0 x1 y1 causes only the given window of the input picture to be copied. By default the whole picture is copied. -o x y causes the output picture's WINDOW= attribute to be translated by adding (x,y) to the input window coordinates. -t type sets the TYPE= attribute of the output file. The default is to use the input file's type. -c channels causes only the given channels of the input picture to be copied. The default is to copy all channels. If channels not present in the input picture are specified, they are computed in the ``most plausible'' way. For example, a missing alpha channel is set to 255, and an m channel will be synthesized from rgb channels by computing NTSC luminance. A 0 in channels causes a zero channel to be written. -C channels sets the output CHAN= attribute. Channels must be the same length as the selected channels of the input picture. -m colormap attaches the given color map to the output. -M elides the color map from the output. SOURCE
/sys/src/fb/pcp.c SEE ALSO
picfile(9.6), cmap(9.6) PCP(9.1)
All times are GMT -4. The time now is 07:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy