Sponsored Content
Top Forums Shell Programming and Scripting Awk multiple lines with 3rd column onto a single line? Post 302264780 by SoMoney on Thursday 4th of December 2008 06:43:36 PM
Old 12-04-2008
okay that's awesome, I never expected it to be a one liner!
I sure would like to learn how you determined nawk was the best tool for this job.

I know I can rtfm and figure this out but if possible, I sure would appreciate a translation of how FS and idx play into this final solution Smilie

Or is that outside the realm of these forums?

Last edited by SoMoney; 12-04-2008 at 07:49 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Splitting a single line into multiple lines

I have a case where, I need to look into a file. Go to each line of the file, find the length of the line, if the length of the line is more than 75 chars, I need to split the line into multiple lines of 75chars max. If the length of the line is less than 75, we need not do anything. So at the... (4 Replies)
Discussion started by: thanuman
4 Replies

2. Shell Programming and Scripting

Multiple lines into a single line

Hi, I've some files with the following data and i need to convert the lines between the separator ---, into a single line. I've tried with the paste cmd but my main problem is that the number of lines between the separator is not fix, it can very between 1-4 lines. Input --- 2010-02-22... (4 Replies)
Discussion started by: RickyC9999
4 Replies

3. Shell Programming and Scripting

Combine multiple lines in single line

This is related to one of my previous post but now with a slight difference: I need the "Updated:" to be in one line as well as the "Information:" on one line as well. These are in multiple lines right now as seen below. These can have 2 or more lines that needs to be in one line. System name:... (8 Replies)
Discussion started by: The One
8 Replies

4. Shell Programming and Scripting

Multiple lines in a single column to be merged as a single line for a record

Hi, I have a requirement with, No~Dt~Notes 1~2011/08/1~"aaa bbb ccc ddd eee fff ggg hhh" Single column alone got splitted into multiple lines. I require the output as No~Dt~Notes 1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh" mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies

5. Shell Programming and Scripting

Awk multiple lines with 4th column on to a single line

This is related to one of my previous post.. I have huge file currently I am using loop to read file and checking each line to build this single record, its taking much much time to parse those records.. I thought there should be a way to do this in awk or sed. I found this code in this forum... (7 Replies)
Discussion started by: Vasan
7 Replies

6. Shell Programming and Scripting

Awk match multiple columns in multiple lines in single file

Hi, Input 7488 7389 chr1.fa chr1.fa 3546 9887 chr5.fa chr9.fa 7387 7898 chrX.fa chr3.fa 7488 7389 chr21.fa chr3.fa 7488 7389 chr1.fa chr1.fa 3546 9887 chr9.fa chr5.fa 7898 7387 chrX.fa chr3.fa Desired Output 7488 7389 chr1.fa chr1.fa 2 3546 9887 chr5.fa chr9.fa 2... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

7. Shell Programming and Scripting

Combine multiple lines into single line

Hi All , I have a file with below data # User@Host: xyz @ # Query_time: t1 Lock_time: t2 Rows_sent: n1 Rows_examined: n2 SET timestamp=1396852200; select count(1) from table; # Time: 140406 23:30:01 # User@Host: abc @ # Query_time: t1 Lock_time: t2 Rows_sent: n1 Rows_examined:... (6 Replies)
Discussion started by: rakesh_411
6 Replies

8. Shell Programming and Scripting

Coverting multiple lines to a single line

Hi all, I have a requirement to covert multiple lines in a comma delimited file to a single line through shell scripting. We should compare the data in the first column in each line. If it is same, then the other data should be put in the same line.Below is the sample input and expected output:... (4 Replies)
Discussion started by: Bobby_2000
4 Replies

9. UNIX for Beginners Questions & Answers

Merging multiple lines into single line based on one column

I Want to merge multiple lines based on the 1st field and keep into single record. SRC File: AAA_POC_DB.TAB1 AAA_POC_DB.TAB2 AAA_POC_DB.TAB3 AAA_POC_DB.TAB4 BBB_POC_DB.TAB1 BBB_POC_DB.TAB2 CCC_POC_DB.TAB6 OUTPUT ----------------- 'AAA_POC_DB','TAB1','TAB2','TAB3','TAB4'... (10 Replies)
Discussion started by: raju2016
10 Replies

10. UNIX for Beginners Questions & Answers

Multiple lines to single line

I have code as below # create temporary table `temp4277`(key(waybill_no)) select waybill_no,concat_ws('',card_type,card_series_no) cardinfo from rfid_temp_ticket where waybill_no='4277' group by... (4 Replies)
Discussion started by: kaushik02018
4 Replies
RTFM(1) 						      General Commands Manual							   RTFM(1)

NAME
rtfm - a response for easy questions from clueless lusers SYNOPSIS
rtfm [ -p ] [ -h ] [ -d option ] [ -i interval ] [ -a action ] [ -q luser] DESCRIPTION
rtfm is a command for system administrators to use in dealing with new users. rtfm is useful for dealing with users having trouble with their pictures downloaded from alt.binaries.pictures.erotica. rtfm will continue to run until killed by hand, using `kill processid'. rtfm can be invoked by anyone who has enough of a clue to know what a man page is. OPTIONS
-p Give the answer in a polite fashion. -h Tell the clueless luser to go to hell. Used with the -p option, they'll look forward to the trip. -d option Debug mode using option where option is one of the following: query Ask the luser what part of rtfm that he or she does not understand. planet Ask what planet the luser is from. literacy Ask the luser if the luser can read. english Ask the luser if the luser understands English. Mac Ask the luser if the luser has ever used a computer other than a Macintosh. Nintendo Same as the Mac option, but slightly more harsh. -i interval Enable within interval seconds. interval is the time between a luser asking the same damn fool question. This option must be acti- vated for the -a option. It stores the time of the question in /var/run/luser and checks that file each time that rtfm is activated. interval is a number of minutes, of the form xxx.xx where each x is a decimal digit. The default is 5.00 minutes. -a action This defines some action to be taken in the event that the -i flag condition is met. action can be defined either at the flag level or by a file. The options for flags are as follows: scream Let out a scream of utter frustration. hair Rip out your hair in total frustration. rm Automatic command ran in lusers home directory. It can have an addition -rf flag added. ignore Ignore the luser. warn Warn the other sysadmins. forward Forward to CNS advising. Particullary if the complaint is /dev/null is full. kill Kill all the lusers processes. FILE=file.name Use a file to define a course of actions. This can be any executeable file except those using ksh, which no god-fear- ing right-thinking sysadmin would be caught using lest he be struck down by the wrath of God. -q luser Query file /etc/luser to see if luser is a real luser or a first time luser. FILES
/etc/luser SEE ALSO
mr.biff(2), BUGS
rtfm only checks /var/run/luser when the -a option is specified and after the -i option is invoked. Otherwise /tmp would fill up rapidly on many systems. Also, core may dump if the -a FILE= option is anatomically impossible. GNU Utilities July 27, 1997 RTFM(1)
All times are GMT -4. The time now is 10:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy