Sponsored Content
Top Forums UNIX for Dummies Questions & Answers [Solved] Removing control-m characters from shell script Post 302729817 by abhi_123 on Sunday 11th of November 2012 11:51:47 AM
Old 11-11-2012
Hi bipinajith,

I tried ur code below:
Code:
sed 's/^'$v_header''"$(printf '\015')"'*//g' input_file > output_file

but the output file is not having header.

My req is:

1) Assign the header value from file to a variable in script.
2) This header value now had control-M character present from script.
3) I need to remove this control-M character assigned to that header variable in script. I do not want to remove it from entire file.
I am unable to do this. Could you please help.

Last edited by Scott; 11-11-2012 at 01:12 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Programming

Identifying and removing control characters in a file.

What is the best method to identify an remove control characters in a file. Would it be easier to do this in Unix or in C. (0 Replies)
Discussion started by: oracle8
0 Replies

2. Shell Programming and Scripting

Removing control-Ms (^M)

Anyone know how to remove ^M's from a text file using sed command? (6 Replies)
Discussion started by: djkane
6 Replies

3. Shell Programming and Scripting

control over shell script

Hi.. I have a perl program that uses "system" to execute a shell script called startengine. The script "startengine" itself calls a lot of other smaller scripts to setup the engine etc. It finally has to execute ./engine which is another shell script which is long and takes a long time to... (3 Replies)
Discussion started by: JLJ
3 Replies

4. Shell Programming and Scripting

How to Control Cronjobs using Shell Script??

Hi All, Now i am running the 3 oracle procedures one by one manually. Query: If 1st Procedure OUT_PUT is Success, then call 2nd Procedure. If 2nd Procedure OUT_PUT is Success, then call 3rd Procedure. If 1st Procedure is failed, then no need of calling the other ... (8 Replies)
Discussion started by: hanu_oracle
8 Replies

5. Shell Programming and Scripting

help removing characters for output file in shell script

hi i'm new to shell scripts and have a small problem i am running a batch converter that returns all flash .flv files in a directory and create a png image from each one the problem i have is the $1 variable , its ok on the first call but on the secound call $1.png , i have extra... (1 Reply)
Discussion started by: wingchun22
1 Replies

6. Shell Programming and Scripting

Control browser from shell script

I have a browser running in a separate virtual terminal and would like to be able to send shortcut codes (e.g. ctrl+A) to the browser (and have it react) from a bash script in a separate virtual terminal. I need to keep the script in the separate virtual terminal. (2 Replies)
Discussion started by: slak0
2 Replies

7. Shell Programming and Scripting

Version Control Through the Shell Script

Version Control Through the Shell Script Hi Guys, Apologize for the big request, please take some time and read it completely... This is Very important for me, and ur help is Very much Appriciated. I want to maintain the Version control to all my scripts running in Production server, I am... (6 Replies)
Discussion started by: Anji
6 Replies

8. Shell Programming and Scripting

Removing special characters - Control M

I have developed a small script to remove the Control M characters that get embedded when we move any file from Windows to Unix. For some reason, its not working in all scenarios. Some times I still see the ^M not being removed. Is there anything missing in the script: cd ${inputDir}... (7 Replies)
Discussion started by: vskr72
7 Replies

9. Shell Programming and Scripting

sed replacing specific characters and control characters by escaping

sed -e "s// /g" old.txt > new.txt While I do know some control characters need to be escaped, can normal characters also be escaped and still work the same way? Basically I do not know all control characters that have a special meaning, for example, ?, ., % have a meaning and have to be escaped... (11 Replies)
Discussion started by: ijustneeda
11 Replies

10. UNIX for Dummies Questions & Answers

[solved]removing characters from a mass of file names

I found a closed thread that helped quite a bit. I tried adding the URL, but I can't because I don't have enough points... ? Modifying the syntax to remove ! ~ find . -type f -name '*~\!]*' | while IFS= read -r; do mv -- "$REPLY" "${REPLY//~\!]}"; done These messages are... (2 Replies)
Discussion started by: rabidphilbrick
2 Replies
Test::Inline::Content::Legacy(3pm)			User Contributed Perl Documentation			Test::Inline::Content::Legacy(3pm)

NAME
Test::Inline::Content::Legacy - Test::Inline 2 Content Handler for legacy functions SYNOPSIS
Custom script content generation using Test::Inline 2.000+ with a custom generator functions my $header = "...."; my $function = sub { my $Object = shift; my $Script = shift; return $header . $Script->merged_content; }; my $Inline = Test::Inline->new( ... file_content => $function, ); Migrating this same code to Test::Inline 2.100+ ContentHandler objects my $header = "...."; my $function = sub { my $Object = shift; my $Script = shift; return $header . $Script->merged_content; }; my $ContentHandler = Test::Inline::Content::Legacy->new( $function ); my $Inline = Test::Inline->new( ... ContentHandler => $ContentHandler, ); DESCRIPTION
This class exists to provide a migration path for anyone using the custom script generators in Test::Inline via the "file_content" param. The synopsis above pretty much says all you need to know. METHODS
new $CODE_ref The "new" constructor for "Test::Inline::Content::Legacy" takes a single parameter of a "CODE" reference, as you would have previously provided directly to "file_content". Returns a new "Test::Inline::Content::Legacy" object, or "undef" if not passed a "CODE" reference. coderef The "coderef" accessor returns the "CODE" reference for the object process $Inline $Script The "process" method works with the legacy function by passing the Test::Inline and Test::Inline::Script arguments straight through to the legacy function, and returning it's result as the return value. SUPPORT
See the main SUPPORT section. AUTHOR
Adam Kennedy <adamk@cpan.org>, <http://ali.as/> COPYRIGHT
Copyright 2004 - 2010 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.12.4 2010-11-22 Test::Inline::Content::Legacy(3pm)
All times are GMT -4. The time now is 03:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy