The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Execute .sh file with sudo in it _prasad Shell Programming and Scripting 2 06-13-2008 04:39 PM
execute a .jil file OSD Shell Programming and Scripting 4 10-05-2007 12:20 AM
execute a .jil file OSD UNIX for Advanced & Expert Users 1 10-03-2007 05:11 AM
Need to execute 2 scripts, wait, execute 2 more wait, till end of file halo98 Shell Programming and Scripting 1 08-01-2006 04:42 PM
No permission to execute file markbeeson UNIX for Dummies Questions & Answers 2 07-19-2001 04:54 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-05-2008
buffoonix buffoonix is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 145
Quote:
In my file name Test.SH

I have only this command

Cp fileA.csv fileB.csv
perl -i.bak -0777 -ple's/(".*?)[\r\n]*(.*?")/$1$2/g' fileA.csv
So apart from the typo in the cp command name
I assume the above is the contents of file Test.SH
which you made executable (e.g. by chmod u+x Test.SH).
(Btw, why the extra copy of fileA.csv to fileB.csv beforehand?
Your Perl oneliner is called with the in-place-editing option -i
which will automatically dump a backup copy fileA.csv.bak for you)

But then you continue with
Quote:
Now I want to run this file

I did

./file.csv
which makes no sense to me at all.
Of course, does the shell complain that the file doesn't exist.
Wasn't it ./Test.SH you wanted to execute?
  #2 (permalink)  
Old 08-05-2008
angelina angelina is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 17
no probs

Last edited by angelina; 08-11-2008 at 05:04 PM..
  #3 (permalink)  
Old 07-30-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
It's not clear from your problem description what the issue is. It would help if you could post the exact error message you are getting.

Some things to try:
  • Add a first line containing #!/bin/sh to the script
  • Add a second line containing the command which perl
  • Add a third line containing the command type perl

Post the output from the resulting script. Use code tags. Thanks.
  #4 (permalink)  
Old 08-06-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
If you could post the output of which perl and type perl and perhaps also locate perl those things might bring some clue.
  #5 (permalink)  
Old 08-06-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,847
As already mentioned you should find the path to your Perl interpreter (perl):

Code:
type perl
Then make a script with the following content (change the path to the Perl interpreter if the previous command indicates a different one):

Code:
#! /usr/bin/perl -i.bak -0777 -p

s/(".*?)[\r\n]*(.*?")/$1$2/g;
Run the script like this:

Code:
./your_script filename
For example:

Code:
./fix_broken_lines fileA
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0