Sponsored Content
Top Forums Shell Programming and Scripting Remove \n <newline> character inside the records. Post 302594795 by Scrutinizer on Wednesday 1st of February 2012 07:49:16 AM
Old 02-01-2012
Try:
Code:
awk '/^[0-9]*,/{if(p)print p; p=$0; next}{p=p$0}END{print p}'  infile


Last edited by Scrutinizer; 02-01-2012 at 09:57 AM..
These 2 Users Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to remove a newline character at the end of filename

Hi All, I have named a file with current date,time and year as follows: month=`date | awk '{print $2}'` date=`date | awk '{print $3}'` year=`date | awk '{print $6}'` time=`date +%Hh_%Mm_%Ss'` filename="test_"$month"_"$date"_"$year"_"$time".txt" > $filename The file is created with a... (2 Replies)
Discussion started by: amio
2 Replies

2. Shell Programming and Scripting

To remove the newline character while appending into a file

Hi All, We append the output of a file's size in a file. But a newline character is appended after the variable. Pls help how to clear this. filesize=`ls -l test.txt | awk `{print $5}'` echo File size of test.txt is $filesize bytes >> logfile.txt The output we got is, File size of... (4 Replies)
Discussion started by: amio
4 Replies

3. Shell Programming and Scripting

Remove newline character conditionally

Hi All, I have 5000 records like this Request_id|Type|Status|Priority|Ticket Submitted Date and Time|Actual Resolved Date and Time|Current Ticket Owner Group|Case final Ticket Owner Group|Customer Severity|Reported Symptom/Request|Component|Hot Topic|Reason for Missed SLA|Current Ticket... (2 Replies)
Discussion started by: j_53933
2 Replies

4. Shell Programming and Scripting

any savant ? using AWK/SED to remove newline character between two strings : conditional removal

I'd like to remove (do a pattern or precise replacement - this I can handle in SED using Regex ) ---AFTER THE 1ST Occurrence ( i.e. on the 2nd occurrence - from the 2nd to fourth occurance ) of a specific string : type 1 -- After the 1st occurrence of 1 string1 till the 1st occurrence of... (4 Replies)
Discussion started by: sieger007
4 Replies

5. Shell Programming and Scripting

Remove newline character or join the broken record

Hi, I have a very huge file, around 1GB of data. I want to remove the newline characters in the file but not preceded by the original end delimiter {} sample data will look like this 1234567 abcd{} 1234sssss as67 abcd{} 12dsad3dad 4sdad567 abcdsadd{} this should look like this... (6 Replies)
Discussion started by: ratheeshjulk
6 Replies

6. Shell Programming and Scripting

Remove newline character between two delimiters

hi i am having delimited .dat file having content like below. test.dat(5 line of records) ====== PT2~Stag~Pt2 Stag Test. Updated~PT2 S T~Area~~UNCEF R20~~2012-05-24 ~2014-05-24~~ PT2~Stag y~Pt2 Stag Test. Updated~PT2 S T~Area~METR~~~2012-05-24~2014-05-24~~test PT2~Pt2 Stag Test~~PT2 S... (4 Replies)
Discussion started by: sushine11
4 Replies

7. UNIX for Dummies Questions & Answers

Ctrl-V + Ctrl-J for newline character does not work inside vi editor

Hi friends, I am trying to add a newline char ('\n') between the query and the commit statement in the following shell script. #! /bin/sh echo "select * from tab; commit;" > data.sql I have tried typing in "Ctrl-V + Ctrl-J" combination which has inserted ^@ (NUL) character but the commit... (1 Reply)
Discussion started by: royalibrahim
1 Replies

8. Shell Programming and Scripting

Remove last newline character..

Hi all.. I have a text file which looks like below: abcd efgh ijkl (blank space) I need to remove only the last (blank space) from the file. When I try wc -l the file name,the number of lines coming is 3 only, however blank space is there in the file. I have tried options like... (14 Replies)
Discussion started by: Sathya83aa
14 Replies

9. Shell Programming and Scripting

How to remove newline character if it is the only character in the entire file.?

I have a file which comes every day and the file data look's as below. Vi abc.txt a|b|c|d\n a|g|h|j\n Some times we receive the file with only a new line character in the file like vi abc.txt \n (8 Replies)
Discussion started by: rak Kundra
8 Replies

10. UNIX for Beginners Questions & Answers

Remove newline character from column spread over multiple lines in a file

Hi, I came across one issue recently where output from one of the columns of the table from where i am creating input file has newline characters hence, record in the file is spread over multiple lines. Fields in the file are separated by pipe (|) delimiter. As header will never have newline... (4 Replies)
Discussion started by: Prathmesh
4 Replies
Prophet::Replica::prophet(3pm)				User Contributed Perl Documentation			    Prophet::Replica::prophet(3pm)

Replica Format
       overview

	$URL
	   /<db-uuid>/
	       /replica-uuid
	       /latest-sequence-no
	       /replica-version
	       /cas/records/<substr(sha1,0,1)>/substr(sha1,1,1)/<sha1>
	       /cas/changesets/<substr(sha1,0,1)>/substr(sha1,1,1)/<sha1>
	       /records (optional?)
		   /<record type> (for resolution is actually _prophet-resolution-<cas-key>)
		       /<record uuid> which is a file containing a list of 0 or more rows
			   last-changed-sequence-no : cas key

	       /changesets.idx

		   index which has records:
		       each record is : local-replica-seq-no : original-uuid : original-seq-no : cas key
		   ...

	       /resolutions/
		   /replica-uuid
		   /latest-sequence-no
		   /cas/<substr(sha1,0,1)>/substr(sha1,1,1)/<sha1>
		   /content (optional?)
		       /_prophet-resolution-<cas-key>	(cas-key == a hash the conflicting change)
			   /<record uuid>  (record uuid == the originating replica)
			       last-changed-sequence-no : <cas key to the content of the resolution>

		   /changesets.idx
		       index which has records:
			   each record is : local-replica-seq-no : original-uuid : original-seq-no : cas key
		       ...

       Inside the top level directory for the mirror, you'll find a directory named as a hex-encoded UUID.  This directory is the root of the
       published replica. The uuid uniquely identifes the database being replicated.  All replicas of this database will share the same UUID.

       Inside the <db-uuid> directory, are a set of files and directories that make up the actual content of the database replica:

       "replica-uuid"
	 Contains the replica's hex-encoded UUID.

       "replica-version"
	 Contains a single integer that defines the replica format.

	 The current replica version is 1.

       "latest-sequence-no"
	 Contains a single integer, the replica's most recent sequence number.

       "cas/records"
       "cas/changesets"
	 The "cas" directory holds changesets and records, each keyed by a hex-encoded hash of the item's content. Inside the "cas" directory,
	 you'll find a two-level deep directory tree of single-character hex digits.  You'll find  the changeset with the sha1 digest
	 "f4b7489b21f8d107ad8df78750a410c028abbf6c" inside "cas/changesets/f/4/f4b7489b21f8d107ad8df78750a410c028abbf6c".

	 You'll find the record with the sha1 digest "dd6fb674de879a1a4762d690141cdfee138daf65" inside
	 "cas/records/d/d/dd6fb674de879a1a4762d690141cdfee138daf65".

	 TODO: define the format for changesets and records

       "records"
	 Files inside the "records" directory are index files which list off all published versions of a record and the key necessary to retrieve
	 the record from the content-addressed store.

	 Inside the "records" directory, you'll     warn "Got types ".join(',',@types);find directories named for each "type" in your database.
	 Inside each "type" directory, you'll find a two-level directory tree of single hexadecimal digits. You'll find the record with the type
	 <Foo> and the UUID "29A3CA16-03C5-11DD-9AE0-E25CFCEE7EC4" stored in

	  records/Foo/2/9/29A3CA16-03C5-11DD-9AE0-E25CFCEE7EC4

	 The format of record files is:

	     <unsigned-long-int: last-changed-sequence-no><40 chars of hex: cas key>

	 The file is sorted in asecnding order by revision id.

       "changesets.idx"
	 The "changesets.idx" file lists each changeset in this replica and provides an index into the content-addressed storage to fetch the
	 content of the changeset.

	 The format of record files is:

	     <unsigned-long-int: sequence-no><16 bytes: changeset original source uuid><unsigned-long-int: changeset original source sequence no><16 bytes: cas key - sha1 sum of the changeset's content>

	 The file is sorted in ascending order by revision id.

       "resolutions"
	 TODO DOC RESOLUTIONS

   BUILD
       Open a connection to the prophet replica source identified by "$self-"url>.

   replica_version
       Returns this replica's version.

   set_replica_version
       Sets the replica's version to the given integer.

   uuid
       Return the replica's UUID

Internals of record handling
   changesets_for_record { uuid => $uuid, type => $type, limit => $int }
       Returns an ordered set of changeset objects for all changesets containing changes to this object.

       Note that changesets may include changes to other records

       If "limit" is specified, only returns that many changesets (starting from record creation).

perl v5.10.1							    2009-12-22					    Prophet::Replica::prophet(3pm)
All times are GMT -4. The time now is 06:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy