Sponsored Content
Top Forums UNIX for Dummies Questions & Answers I don't want to truncate trailing spaces and ^M at the end of line Post 302381072 by Shobana_s on Thursday 17th of December 2009 05:41:21 AM
Old 12-17-2009
Thanks for your help!

Here are the details that you requested

Sample lines from input file:
002009101307350520093320091013335 ^M
0102654N3FKAA20091013S0013200000001 ^M
0233L07A01051624843060000100000001 ^M
0233L07A02050869301010000200000001 ^M
.......

Expected output in new file:
002009101307350520093320091013335 ^M
0102655N3FKAA20091013S0013200000006 ^M
0233L07A01051624843060000100000006 ^M
0233L07A02050869301010000200000006 ^M
.......

Actual Output in new file:
002009101307350520093320091013335
^M
0102655N3FKAA20091013S0013200000006
^M
0233L07A01051624843060000100000006
^M
0233L07A02050869301010000200000006
^M
.......

I'm actually using one file to create multiple files with changes in few fields of the file

Can you let me know the awk command that can be used with this? I tried searching in google but couldn't find. I'm still in the process of searching

Please let me know if you require any further details

Thanks a lot!
Shobana
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Strip leading and trailing spaces only in a shell variable with embedded spaces

I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help. echo $SH_VAR | command_line Syntax. The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
Discussion started by: jerardfjay
6 Replies

2. Shell Programming and Scripting

Trim trailing spaces from each line in a file

Hello folks, Is there a simple way to trim trailing spaces from each line a file. Please let me know. Regards, Tipsy. (5 Replies)
Discussion started by: tipsy
5 Replies

3. Shell Programming and Scripting

To Trim spaces at the end of line

Hi Friends, Can any one help with this issue: How to trim spaces for each line at the end, Like I have a file in this format. EMP1 SMITH 46373 5 STREET HOWARD 74636 EMP2 JONES 5454 { these are spaces ........} EMP3 SMITH 46373 5 STREET HOWARD 74636 EMP4 JON 2554 { these are... (1 Reply)
Discussion started by: sbasetty
1 Replies

4. Shell Programming and Scripting

I don't want to truncate spaces

I have a script that is adding text to a existing file and creating new file. This part is working fine.... But the new file is truncated by script and all null spaced column are truncated. What is my solution...please some body advice .... thanks in advance pre_line="+_)(*&" spaces=" "... (2 Replies)
Discussion started by: naveenkcl
2 Replies

5. Shell Programming and Scripting

remove trailing spaces from a line

I want to remove the trailing spaces from any line of file. line ending does not follow any pattern. plz help (3 Replies)
Discussion started by: vikas_kesarwani
3 Replies

6. UNIX for Dummies Questions & Answers

how to append spaces(say 10 spaces) at the end of each line based on the length of th

Hi, I have a problem where I need to append few spaces(say 10 spaces) for each line in a file whose length is say(100 chars) and others leave as it is. I tried to find the length of each line and then if the length is say 100 chars then tried to write those lines into another file and use a sed... (17 Replies)
Discussion started by: prathima
17 Replies

7. Shell Programming and Scripting

append end of line with 8 spaces

child_amt=$amount prev_line="$prev_line $child_amt" i am getting the result like this 21234567890001343 000001004OLFXXX029100020091112 0000060 but i want 8 spaces between the eg: 21234567890001343 000001004OLFXXX029100020091112 0000060 how can i do this in .ksh (1 Reply)
Discussion started by: kshuser
1 Replies

8. Shell Programming and Scripting

./TRUNCATE-PS_TXN.sh: line 54: syntax error: unexpected end of file

Hi All , My below script is for chacking vaule and then trucating table : ___________ test4@aceuatcs04:/u01/test4/SOLID/Testscript>cat TRUNCATE-PS_TXN.sh #-------------------------------------------------------------------- # Created by:Kaushlesh Yadav # Generated on: 15/07/2010 # Job... (4 Replies)
Discussion started by: kaushelsh168
4 Replies

9. UNIX for Dummies Questions & Answers

delete trailing whitespace from end of each line in column 1 only

Hi All. How can I convert this: ABC_1_1 ABC_1_2 ABC_1_3 into this: ABC_1 1 ABC_1 2 ABC_1 3 I tried this command but it is not working: awk '{sub(/+$/,"\t", $1)}{print}' Any suggestions on how to fix this? Thank you :wall: Please use code tags when posting data and... (3 Replies)
Discussion started by: danieladna
3 Replies

10. UNIX for Beginners Questions & Answers

Remove or truncate trailing nulls from file

I want to remove from a file the trailing null characters (0x00) and stop doing so when a different byte is found (which should not be deleted), and either put the result to the same file or a different one. Any ideas? (9 Replies)
Discussion started by: Tribe
9 Replies
TIE(1)							      General Commands Manual							    TIE(1)

NAME
tie - merge or apply WEB change files SYNOPSIS
tie -c|-m outputfile masterfile changefile... DESCRIPTION
The tie program is used to process multiple change files used with the WEB system for literate programming. The WEB programs allow to apply patches to a source file (the masterfile) by means of a number of change files (often only a single change file is allowed). Tie can be used to either merge up to 32 change files into a single one or to apply the changes to the masterfile in order to create a new one. Output of either the new change file or the patched master file goes into outputfile. OPTIONS
-c Create a single change file from the given changefiles. -m Create a new master file by applying the given changefiles. ENVIRONMENT
The environment variable WEBINPUTS is used to search for the input files, or the system default if WEBINPUTS is not set. See tex(1) for the details of the searching. SEE ALSO
web(1), ctie(1), cweb(1). AUTHOR
Klaus Guntermann, TH Darmstadt, Institut f. Theoretische Informatik. Man page by Joachim Schnitter, TH Darmstadt, Phys. Chemie I. Web2C 2012 7 April 2010 TIE(1)
All times are GMT -4. The time now is 02:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy