Sponsored Content
Top Forums UNIX for Advanced & Expert Users Issue with Removing Carriage Return (^M) in delimited file Post 302176965 by sirahc on Wednesday 19th of March 2008 06:26:42 PM
Old 03-19-2008
Re: Can you provide a hex or octal dump of the file?

Hi joeyg,

Thanks for your reply. Unfortunately, this is sensitive data so I can't send out a dump. I did use the od command to pull the data and checked for \r (od -c). I see that there is carriage return (\r)+ new line control (\n) embedded in the record.

When I used tr -d "\r\n" , however it remove all line breaks with just "\n". Do you know how I can remove only the string "\r\n" without touching those with only "\n"?

Thanks,
sirahc
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Removing carriage return characters from file

Hello there, I need to remove carriage return characters (\n and \r) from any input file specified. This is what I am doing right now: - dumping the file to octal format using the command 'od -c file_name - removing and \s and \n characters using sed commands What I need to do now is... (3 Replies)
Discussion started by: b1saini
3 Replies

2. Shell Programming and Scripting

Removing Carriage return to create one record

I have a file with multiple records in it and want to create a single record by removing all the carriage returns, is there a sed command or another command that will easily allow this to happen. current layout 813209A 813273C 812272B expected result 813209A813273C812272B previously I... (3 Replies)
Discussion started by: r1500
3 Replies

3. Shell Programming and Scripting

sed removing carriage return and newline

Hi, I'm not very familiar with unix shell. I want to replace the combination of two carriage returns and one newline with one carriage return and one newline. I think the best way to do this is to use sed. I tried something like this: sed -e "s#\#\#g" file.txt but it doesn't work. Thanx... (2 Replies)
Discussion started by: mored
2 Replies

4. Shell Programming and Scripting

Removing Carriage Return and or line feed from a file

Hello I'm trying to write a shell script which can remove a carriage return and/or line feed from a file, so the resulting file all ends up on one line. So, I begin with a file like this text in file!<CR> line two!<CR> line three!<CR> END!<CR> And I want to end up with a file... (1 Reply)
Discussion started by: tbone231
1 Replies

5. Shell Programming and Scripting

Carriage Return at end of file

Hi, I have a script that outputs a file that contains the dates from the previous month, which is then used by our application to run processes on each date contained in the file. My problem is is that my script created a blank line at the bottom of the file which causes issues for our... (14 Replies)
Discussion started by: bd_joy
14 Replies

6. UNIX for Dummies Questions & Answers

removing spaces after carriage return

I have a file that I have to place a carriage return at the end of each line for another program to process it. I also need to remove all spaces after the carriage return. I searched the forums and found this command, but it removes all spaces: sed "s/*//g" ic527.txt > ic527.new The... (9 Replies)
Discussion started by: jyoung
9 Replies

7. Shell Programming and Scripting

Removing Carriage return and merging data

Hi, I am trying to remove the carriage return on the record which starts with ADD, MODIFY, or DELETE keyword as the first value in the record. If the records does not start with anyone of these keywords then combine the records with the previous record (line). Input File name xyz.txt... (6 Replies)
Discussion started by: naveed
6 Replies

8. Shell Programming and Scripting

Removal of carriage returns from a comma delimited file

Hi, I have a file which is having some carriage return in one of the field for which single line is coming in multiple lines. I want to combine all those multiple lines of that field into one line. Eg: Input: Id, Name, Location, Comments, Dept 2, John, US, I am from US. I... (5 Replies)
Discussion started by: mahish20
5 Replies

9. Shell Programming and Scripting

Removing Carriage return in a file after particular string

Hi All, I want to remove carriage return in a file using some unix command without writing a script my file is as follows abc1 abc2 abc3 abc4 abc5 bac6 abc1 abc2 abc3 abc4 abc5 bac6 I want the output as follows: abc1 abc2 abc3 abc4 abc5 bac6 abc1 abc2 abc3 abc4 abc5 bac6 , Please... (7 Replies)
Discussion started by: manish8484
7 Replies

10. Shell Programming and Scripting

Removing carriage return/line feeds on multiple lines

I would like to remove carriage returns/line feeds in a text file, but in a specific cadence: Read first line (Header Line 1), remove cr/lf at the end (replace it with a space ideally); Read the next line (Line of Text 2), leave the cr/lf intact; Read the next line, remove the cr/lf; Read... (14 Replies)
Discussion started by: tomr2012
14 Replies
BACKUP_DELETEDUMP(8)					       AFS Command Reference					      BACKUP_DELETEDUMP(8)

NAME
       backup_deletedump - Deletes one or more dump records from the Backup Database

SYNOPSIS
       backup deletedump [-dumpid <dump id>+]
	   [-from <date time>+]
	   [-to <date time>+]
	   [-port <TC port offset>]
	   [-groupid <group ID>]
	   [-dbonly] [-force] [-noexecute] [-localauth]
	   [-cell <cell name>]
	   [-help]

       backup dele [-d <dump id>+]
	   [-fr <date time>+]
	   [-t <date time>+]
	   [-p <TC port offset>]
	   [-g <group ID>]
	   [-db] [-fo] [-n] [-l]
	   [-c <cell name>]
	   [-h]

DESCRIPTION
       The backup deletedump command deletes one or more dump records from the Backup Database. Either use the -dumpid argument to specify the
       dump ID number of one or more dumps, or use the -from and -to arguments to delete the records for all regular dumps created during the time
       period bracketed by the specified values.

       Use this command to remove dump records that are incorrect (possibly because a dump operation was interrupted or failed), or that
       correspond to dumps that are expired or otherwise no longer needed.

CAUTIONS
       The only way to remove the dump record for an appended dump is to remove the record for its initial dump, and doing so removes the records
       for all of the initial dump's associated appended dumps.

       The only way to remove the record for a Backup Database dump (created with the backup savedb command) is to specify its dump ID number with
       the -dumpid argument. Using the -from and -to arguments never removes database dump records.

       Removing records of a dump makes it impossible to restore data from the corresponding tapes or from any dump that refers to the deleted
       dump as its parent, directly or indirectly. That is, restore operations must begin with the full dump and continue with each incremental
       dump in order. If the records for a specific dump are removed, it is not possible to restore data from later incremental dumps unless the
       deleted records are restored by running the backup scantape command with the -dbadd flag.

       If a dump set contains any dumps that were created outside the time range specified by the -from and -to arguments, the command does not
       delete any of the records associated with the dump set, even if some of them represent dumps created during the time range.

OPTIONS
       -dumpid <dump id>+
	   Specifies the dump ID of each dump record to delete. The corresponding dumps must be initial dumps; it is not possible to delete
	   appended dump records directly, but only by deleting the record of their associated initial dump. Using this argument is the only way
	   to delete records of Backup Database dumps (created with the backup savedb command).

	   Provide either this argument or the -to (and optionally -from) argument.

       -from <date time>+
	   Specifies the beginning of a range of dates; the record for any dump created during the indicated period of time is deleted.

	   Omit this argument to indicate the default of midnight (00:00 hours) on 1 January 1970 (UNIX time zero), or provide a date value in the
	   format mm/dd/yyyy [hh:MM]. The month (mm), day (dd), and year (yyyy) are required. The hour and minutes (hh:MM) are optional, but if
	   provided must be in 24-hour format (for example, the value "14:36" represents 2:36 p.m.). If omitted, the time defaults to midnight
	   (00:00 hours).

	   The -to argument must be provided along with this one.

       -to <date time>+
	   Specifies the end of a range of dates; the record of any dump created during the range is deleted from the Backup Database.

	   Provide either the value "NOW" to indicate the current date and time, or a date value in the same format as for the -from argument.
	   Valid values for the year (yyyy) range from 1970 to 2037; higher values are not valid because the latest possible date in the standard
	   UNIX representation is in February 2038. The command interpreter automatically reduces any later date to the maximum value.

	   If the time portion (hh:MM) is omitted, it defaults to 59 seconds after midnight (00:00:59 hours). Similarly, the backup command
	   interpreter automatically adds 59 seconds to any time value provided. In both cases, adding 59 seconds compensates for how the Backup
	   Database and backup dumpinfo command represent dump creation times in hours and minutes only. For example, the Database records a
	   creation timestamp of "20:55" for any dump operation that begins between 20:55:00 and 20:55:59.  Automatically adding 59 seconds to a
	   time thus includes the records for all dumps created during that minute.

	   Provide either this argument, or the -dumpid argument.  This argument is required if the -from argument is provided.

	   Caution: Specifying the value "NOW" for this argument when the -from argument is omitted deletes all dump records from the Backup
	   Database (except for Backup Database dump records created with the backup savedb command).

       -localauth
	   Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The backup command interpreter presents it to
	   the Backup Server, Volume Server and VL Server during mutual authentication. Do not combine this flag with the -cell argument. For more
	   details, see backup(8).

       -cell <cell name>
	   Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see backup(8).

       -help
	   Prints the online help for this command. All other valid options are ignored.

OUTPUT
       At the conclusion of processing, the output lists the dump IDs of all dump records deleted in the following format:

	  The following dumps were deleted:
	       dump ID 1
	       dump ID 2
	       etc.

EXAMPLES
       The following command deletes the dump record with dump ID 653777462, and for any appended dumps associated with it:

	  % backup deletedump -dumpid 653777462
	  The following dumps were deleted:
	       653777462

       The following command deletes the Backup Database record of all dumps created between midnight on 1 January 1997 and 23:59:59 hours on 31
       December 1997:

	  % backup deletedump -from 01/01/1997 -to 12/31/1997
	  The following dumps were deleted:
	       598324045
	       598346873
		  ...
		  ...
	       653777523
	       653779648

PRIVILEGE REQUIRED
       The issuer must be listed in the /etc/openafs/server/UserList file on every machine where the Backup Server is running, or must be logged
       onto a server machine as the local superuser "root" if the -localauth flag is included.

SEE ALSO
       backup(8), backup_dumpinfo(8), backup_scantape(8)

COPYRIGHT
       IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.

       This documentation is covered by the IBM Public License Version 1.0.  It was converted from HTML to POD by software written by Chas
       Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.

OpenAFS 							    2012-03-26						      BACKUP_DELETEDUMP(8)
All times are GMT -4. The time now is 09:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy