Sponsored Content
Top Forums Shell Programming and Scripting Combine multiline to one line till a blank line Post 302950231 by RudiC on Wednesday 22nd of July 2015 02:45:37 PM
Old 07-22-2015
Any attempt from your side?

---------- Post updated at 20:45 ---------- Previous update was at 20:44 ----------

Howsoever, try
Code:
awk 'NF {TMP=TMP $0; next} {print TMP ";"; TMP=""} END {print TMP ";"}' file3
ABCDEFGHIJKL;
MNOPQRSTUVWX;
YZA;

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

how to read a file till it encounters a blank line

Hi , I want to read a file starting with "*" up to till it encounters a blank line and to redirect this output to a different file.Plz suggest how to write a script for this. e.g:- * PK Sent Email (11.23) CALYPSO 1243215 9116457 NEW TRAD FAILED Nov 23 2007 9:34AM OASYS: DPS:... (0 Replies)
Discussion started by: adityam
0 Replies

2. Shell Programming and Scripting

how to read a file till it encounters a blank line

Hi , I want to read a file starting with "*" up to till it encounters a blank line and to redirect this output to a different file.Plz suggest how to write a script for this. e.g:- * PK Sent Email (11.23) CALYPSO 1243215 9116457 NEW TRAD FAILED Nov 23 2007 9:34AM OASYS: DPS: SINGCORP invalid... (1 Reply)
Discussion started by: adityam
1 Replies

3. UNIX for Dummies Questions & Answers

how to read a file till it encounters a blank line

Hi , I want to read a file starting with "*" up to till it encounters a blank line and to redirect this output to a different file.Plz suggest how to write a script for this. e.g:- * PK Sent Email (11.23) CALYPSO 1243215 9116457 NEW TRAD FAILED Nov 23 2007 9:34AM OASYS: DPS: SINGCORP invalid... (1 Reply)
Discussion started by: adityam
1 Replies

4. UNIX for Dummies Questions & Answers

Read lines till a blank line is encountered

Hi, I have reached at a specified offset from the start of file. My requirement is that I want to read only those lines, which have the string READ / ALTER / UPDATE. As soon as, none of these literals are found in the subsequent line, I want to stop reading. Is there any feature of grep which... (1 Reply)
Discussion started by: saurabhsinha23
1 Replies

5. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

6. Shell Programming and Scripting

Fill the empty line by adding line before blank line

FIle A "A" 2 aa 34 3 ac 5 cd "B" 3 hu 67 4 fg 5 gy output shud be A"" 2 aa 34 "A" 3 ac 34 "A" 5 cd 34 "B" 3 hu 67 "B" 4 fg 67 "B" 5 gy 67 (6 Replies)
Discussion started by: cdfd123
6 Replies

7. Shell Programming and Scripting

Awk script to match pattern till blank line

Hi, I need to match lines after a pattern, upto the first blank line. Searched in web and some forums but coulnt find the answer. where <restart_step> = 10 -- Execute query 20 -- Write the contents to the Oracle table 30 -- Writing Contents to OUTPUT... (7 Replies)
Discussion started by: justchill
7 Replies

8. Shell Programming and Scripting

How to start reading from the nth line till the last line of a file.

Hi, For my reuirement, I have to read a file from the 2nd line till the last line<EOF>. Say, I have a file as test.txt, which as a header record in the first line followed by records in rest of the lines. for i in `cat test.txt` { echo $i } While doing the above loop, I have read... (5 Replies)
Discussion started by: machomaddy
5 Replies

9. Shell Programming and Scripting

Bash script to read a file from particular line till required line and process

Hi All, Am trying to write wrapper shell/bash script on a utility tool for which i need to pass 2 files as arugment to execute utility tool. Wraper script am trying is to do with above metion 2 files. utility tool accepts : a. userinfo file : which contains username b. item file : which... (2 Replies)
Discussion started by: Optimus81
2 Replies

10. Shell Programming and Scripting

Combine multiline to one line with proper format

Hello Guys, I have a file say FILE1.txt contains below data:- A B C D E F G H I J K L I need the output in another file as FILE2 as:- 'A', 'B', 'C', 'D', 'E', (7 Replies)
Discussion started by: jassi10781
7 Replies
SHTOOL-ARX.TMP(1)					      GNU Portable Shell Tool						 SHTOOL-ARX.TMP(1)

NAME
shtool-arx - GNU shtool ar(1) extensional command SYNOPSIS
shtool arx [-t|--trace] [-C|--command cmd] op archive file [file ...] DESCRIPTION
shtool arx is a wrapper around the archiving tool ar(1). It provides the ability to create archives out of existing archives, i.e., if one of file matches ""*.a"", the archive member files of file are used instead of file itself. The trick of this command is the automatic handling of archive members which is especially interesting if one wants to construct a (usually top-level) library archive out of pre-built sub-library archives (usually staying inside subdirs) in a large source tree. For GNU libtool based projects, a similar functionality is provided by GNU libtool internally, too. OPTIONS
The following command line options are available. -t, --trace Shows the actually involved shell commands. -C, --command cmd Set the used ar(1) command to cmd instead of just "ar" (searched in $PATH). EXAMPLE
# Makefile AR=ar RANLIB=ranlib : OBJS=foo.o bar.o LIBS=baz/libbaz.a quux/libquux.a : libfoo.a: $(OBJS) $(LIBS) shtool arx -C $(AR) rc libfoo.a $(OBJS) $(LIBS) $(RANLIB) libfoo.a HISTORY
The GNU shtool arx command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 1999 for GNU shtool. It was prompted by need to build libraries out of sub-libraries inside the OSSP project. SEE ALSO
shtool(1), ar(1). 18-Jul-2008 shtool 2.0.8 SHTOOL-ARX.TMP(1)
All times are GMT -4. The time now is 11:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy