04-15-2013
Join lines in a file????
Hello UNIX gurus, I am new to the world of UNIX. Hopefully I am submitting my question at the right forum. Here is my dilemma -
I have a file with contents like this -
"line1","Hello","World","Today is a wonderful day","yes it is"
"line2","Hello","World","Today is a
beautiful day","oh yeah"
"line3","Hello","World","Today is a great
day","right you are"
"line4","Hello","World","Today is really an awesome day","you can say that again"
you may have observed that some of the records do not appear in a single line. For example line2 and line3 have broken off and a part of them is in a different line. I am desperately looking for a way to join these broken records so that I can have them in a single line. Is there a command I can use which will read the records in a file, then correct the broken lines and then create a file with proper records? I hope this is possible. Please help.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I've looked at the join command which is able to perform what I need on two rows with a common field, however if I have more than two rows I need to join all of them.
Thus I have one file with multiple rows to be joined on an index number:
1 randomtext1
2 rtext2
2 rtext3
3 rtext4
3 rtext5... (5 Replies)
Discussion started by: crimper
5 Replies
2. Shell Programming and Scripting
hi all i have sample and i need script to do this
/dev/xxx oracle test
/dev/sap
9999 000 88 99
i need the out put like this
/dev/xxx oracle test
/dev/sap 9999 000 88 99
can any one provide me with an idea to solve this problem (8 Replies)
Discussion started by: maxim42
8 Replies
3. Shell Programming and Scripting
Hi,
I lack the utter fundamentals on how to craft an awk script.
I have hundreds of text files that were mangled by .doc format so all the lines are broken up so I need to join all of the lines of text into a single line. Normally I use vim command "ggVGJ" to join all lines but with so many... (3 Replies)
Discussion started by: n00ti
3 Replies
4. Shell Programming and Scripting
I have a vim outliner file like this:
Title
title 2
:Testing now
:testing 2
:testing 3
title 3
:testing
:ttt
:ttg
Is there a way to use a script or command to remove... (7 Replies)
Discussion started by: jostber
7 Replies
5. Shell Programming and Scripting
HI all,
i have a input file,i have to join 2nd line into firstline and 4th line into 2nd line and so on..
for this we also consider odd no. of line.It's operate on original input file but output file should temp file.
like ..
filename=cdr.cfg
line1
line2
line3
line4Desired output should be... (9 Replies)
Discussion started by: suryanarayan
9 Replies
6. Shell Programming and Scripting
I have a file that contains 87 lines, each with a set of coordinates (x & y). This file looks like:
1 200.3 -0.3
2 201.7 -0.32
...
87 200.2 -0.314
I have another file which contains data that was taken at certain of these 87 positions. i.e.:
37 125
42 175
86 142
where the first... (1 Reply)
Discussion started by: jackiev
1 Replies
7. Shell Programming and Scripting
I have a file like this:
---------------------------------------------------------------
26
00:04:48,440 --> 00:04:51,440
I don't know why he can't just do
the Great Apache Flaming Arrow Act.
27
00:04:52,440 --> 00:04:54,839
Didn't you tell him
to use the gopher snake?
28... (1 Reply)
Discussion started by: thailand
1 Replies
8. Shell Programming and Scripting
Hi Guys,
Could you please advise how to join multiple details lines into single row, with HEADER 1 as the record separator and comma(,) as the field separator.
Input:
HEADER 1, HEADER 2, HEADER 3,
11,22,33,
COLUMN1,COLUMN2,COLUMN3,
AA1, BB1, CC1,
END: ABC
HEADER 1, HEADER 2,... (3 Replies)
Discussion started by: budz26
3 Replies
9. Shell Programming and Scripting
Hi all,
Is there any idea on how to automate convert the paragraph in one line in a file, this will happen after OCR the documents, OCR split every paragraph. I need to join all the paragraph in one line.
#cat file.txtThe Commission on Higher Education (CHED) was created through Republic Act... (7 Replies)
Discussion started by: lxdorney
7 Replies
10. Shell Programming and Scripting
Hi all,
I need help to parse this xml file that has paragraphs broken in different lines and I would like to join in a single line.
I hope you can understand my explanation. Thanks for any help/direction.
The script could be in bash, awk, ruby, perl whatever please
In the output I want:... (8 Replies)
Discussion started by: Ophiuchus
8 Replies
runacct(1M) runacct(1M)
NAME
runacct - run daily accounting
SYNOPSIS
[mmdd[state]]
DESCRIPTION
runacct is the main daily accounting shell procedure. It is normally initiated via cron(1M). runacct processes connect, fee, disk, and
process accounting files. It also prepares summary files for prdaily or billing purposes.
runacct takes care not to damage active accounting files or summary files in the event of errors. It records its progress by writing
descriptive diagnostic messages into When an error is detected, a message is written to mail (see mail(1), mailx(1), or elm(1)) is sent to
and and runacct terminates. runacct uses a series of lock files to protect against re-invocation. The files and are used to prevent
simultaneous invocation, and is used to prevent more than one invocation per day.
runacct breaks its processing into separate, restartable states using to remember the last state completed. It accomplishes this by writ-
ing the state name into runacct then looks in to see what it has done and to determine what to process next. states are executed in the
following order:
Move active accounting files into working files.
Verify integrity of
file, correcting date changes if necessary.
Produce connect session records in
format.
Convert process accounting records into
format.
Merge the connect and process accounting records.
Convert output of
chargefee into format and merge with connect and process accounting records.
Merge disk accounting records with connect, process, and fee accounting
records.
Merge the daily total accounting records in
with the summary total accounting records in
Produce command summaries.
Any installation-dependent accounting programs can be
included here.
Cleanup temporary files and exit.
To restart runacct after a failure, first check the file for diagnostics, then fix up any corrupted data files such as or The files and
file must be removed before runacct can be restarted. The argument mmdd is necessary if runacct is being restarted, and specifies the
month and day for which runacct will rerun the accounting. Entry point for processing is based on the contents of to override this,
include the desired state on the command line to designate where processing should begin.
EXAMPLES
To start runacct.
To restart runacct.
To restart runacct at a specific state.
WARNINGS
Normally it is not a good idea to restart runacct in its state. Run manually, then restart via:
If runacct failed in its state, remove the last file because it will not be complete.
FILES
SEE ALSO
mail(1), acct(1M), acctcms(1M), acctcom(1M), acctcon(1M), acctmerg(1M), acctprc(1M), acctsh(1M), cron(1M), fwtmp(1M), acct(2), acct(4),
utmp(4).
STANDARDS CONFORMANCE
runacct(1M)