LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-02-2012, 01:44 AM   #1
dentys
LQ Newbie
 
Registered: Jun 2011
Distribution: Ubuntu Desktop, Debian server
Posts: 12

Rep: Reputation: Disabled
Angry when i run sed from crontab environment, it gives me errors


Hi,

I have a simple bash script which runs this command

Code:
/bin/sed  -i y/şàúŞȘâöìåâşăș/sauSSaoiaasas/ 1341180120.H390916P16090.something.yoyo.ro:2,S 2>&1
If i runnit from console, everithing works as espected.

When i runnit from crontab, i get this error

Code:
/bin/sed: -e expression #1, char 43: strings for `y' command are different lengths
I've been searching already for a few days for a sollution and it seems i'm unique in some way
Help, please.

Last edited by dentys; 07-02-2012 at 01:54 AM.
 
Old 07-02-2012, 03:33 AM   #2
Slackyman
Member
 
Registered: Mar 2011
Location: Rome - Italy
Distribution: Slackware 13.1
Posts: 347

Rep: Reputation: 44
Have you set a different charset for your user environment?
 
Old 07-02-2012, 05:59 AM   #3
dentys
LQ Newbie
 
Registered: Jun 2011
Distribution: Ubuntu Desktop, Debian server
Posts: 12

Original Poster
Rep: Reputation: Disabled
in both cases the user environment is root.
from console i get

LANG=en_US.UTF-8

in cronenv is not set. i tryied to specify the LANG var in the script, but there was no change. If i don't understand what you mean by charset, please be more explicite.
 
Old 07-02-2012, 06:04 AM   #4
Slackyman
Member
 
Registered: Mar 2011
Location: Rome - Italy
Distribution: Slackware 13.1
Posts: 347

Rep: Reputation: 44
I meant the "UTF-8" part of LANG.
Did you "set" LANG in your script or DID you "export"?
 
1 members found this post helpful.
Old 07-02-2012, 06:14 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Have you tried quoting the "y command"?---eg sed -i 'y/abc/ABC' filename

Is this the filename that sed is operating on?
Quote:
1341180120.H390916P16090.something.yoyo.ro:2,S
 
Old 07-02-2012, 09:39 AM   #6
dentys
LQ Newbie
 
Registered: Jun 2011
Distribution: Ubuntu Desktop, Debian server
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Slackyman View Post
I meant the "UTF-8" part of LANG.
Did you "set" LANG in your script or DID you "export"?
i don't want to tell you what i did!

adding this to the script solved the problem.
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"

The locale parameters, in cron env, were set to POSIX. Switching them to "en_US.UTF-8" solved the issue.

thread can be closed.
you were verry helpfull.
Thank You (!)
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sed help to run sed command against multiple different file names bkone Programming 2 04-16-2012 12:27 PM
My BASH script work perfect when i run it manualy, but not when it run in the crontab roqarg Linux - Newbie 30 05-06-2010 01:37 PM
Crontab Environment Problems bengoavs Linux - Software 5 11-16-2007 11:11 AM
script in crontab do not execute or take proper environment of user mayank_a Linux - Server 1 07-02-2007 05:03 AM
/etc/crontab & environment variables gepesz Linux - Software 3 09-03-2004 01:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration