Sponsored Content
Top Forums Shell Programming and Scripting Removing Carriage return in a file after particular string Post 302587160 by jayan_jay on Wednesday 4th of January 2012 07:22:52 AM
Old 01-04-2012
Incase the second line has 3 values then it will fail .. Smilie It will not bind 2 lines as a single line ..
Code:
$ cat infile
abc1 abc2 abc3 abc4
abc5 bac6 abc1
abc1 abc2 abc3 abc4
abc5 bac6
$
$ xargs -n 6 < infile
abc1 abc2 abc3 abc4 abc5 bac6
abc1 abc1 abc2 abc3 abc4 abc5
bac6
$
$ xargs -L 2 < infile
abc1 abc2 abc3 abc4 abc5 bac6 abc1
abc1 abc2 abc3 abc4 abc5 bac6
$

 

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

deleting 'carriage return' from string

hi there I'm getting a string from a sqlplus query, and I need to compare it with another string Problem here, is that the string i get from query brings a 'carriage return' with it, and comparing throws always false value. i need to delete all carriage retun charactres in string. how... (6 Replies)
Discussion started by: viko
6 Replies

6. UNIX for Advanced & Expert Users

Issue with Removing Carriage Return (^M) in delimited file

Hi - I tried to remove ^M in a delimited file using "tr -d "\r" and "sed 's/^M//g'", but it does not work quite well. While the ^M is removed, the format of the record is still cut in half, like a,b, c c,d,e The delimited file is generated using sh script by outputing a SQL query result to... (7 Replies)
Discussion started by: sirahc
7 Replies

7. 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

8. 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

9. 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

10. Shell Programming and Scripting

ksh string replacement over a carriage return

Hi. I need to make multiple string replacements in a file but several of the strings have been broken up by a carriage return so that the first few characters are on one line and the remainder on the following line. E.g like the word 'post' in the following: Use descriptive thread... (3 Replies)
Discussion started by: Big_Jeffrey
3 Replies
vselect(1Vi)															      vselect(1Vi)

NAME
vselect - select objects from a Vista data file SYNOPSIS
vselect [-option ...] [infile] [outfile] DESCRIPTION
vselect copies selected objects from an input file to an output file. Command line options specify which objects are to be copied. Objects may be selected by type (e.g., all images), by name, by the value of some attribute, or by position within the input file. COMMAND LINE OPTIONS
vselect accepts the following options: -help Prints a message describing options. -in Specifies a Vista data file from which objects are to be selected. -out Specifies where to write the selected objects as a Vista data file. The input and output files can be specified on the command line or allowed to default to the standard input and output streams. In addition, exactly one of the following options must be used to specify the objects to be selected: -object i Select the ith object. Objects in the input file are numbered consecutively from 0. -name name Select any object whose attribute name is name. -type type Select any object whose type is type. -attr name value Select any object having an attribute with the specified name and value. Finally, any of these selection criteria can be inverted: -not Reverses the sense of the selection criterion. EXAMPLES
To select the first object from a file: vselect -object 0 < infile > outfile To select the attribute named ``cantaloupe'' from a file: vselect -name cantaloupe < infile > outfile To select everything but images from a file: vselect -type image -not < infile > outfile To select images with ubyte pixels from a file of images: vselect -attr nbands ubyte < infile > outfile AUTHOR
Art Pope <pope@cs.ubc.ca> Vista Version 1.12 24 April 1993 vselect(1Vi)
All times are GMT -4. The time now is 02:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy