- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Strange Issue With sed command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2005 01:26 PM
11-11-2005 01:26 PM
Strange Issue With sed command
We are having a script which gets executed whenever we recieve a file in a particular mailbox and the script is suppose to move the file to another folder and before that It does following processing using sed
sed -e "1,25s/^charset=/ charset=/g" /tmp/${FILENAME} >
/tmp/${FILENAME}.tmp
What I understand from the above command is it is replacing the TAB space from the mail header.
But What is happening is when it processes mail using sed and moves to the folder Intergration Server processes the first document but fails with other files and what we noticed in the header is the success one's and failed once are having different headers.
Can anyone please help.
Thanks,
Amit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2005 01:38 AM
11-12-2005 01:38 AM
Re: Strange Issue With sed command
As written this code processes the first 25-lines (1-25) of /tmp${FILENAME}. If, anchored (^) to the beginning of a line, string "charset=" appears, a space (blank) character is inserted before the string. The output is, including any lines beyond #25 that do not receive substitution is written to /tmp/${FILENAME}.tmp.
There is no TAB character apparent in your post.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2005 07:07 AM
11-12-2005 07:07 AM
Re: Strange Issue With sed command
JRF is correct, no TAB character in the substitution pattern. Could you clarify the following lines:
>> But What is happening is when it processes mail using sed and moves to the folder Intergration Server processes the first document but fails with other files and what we noticed in the header is the success one's and failed once are having different headers <<
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2005 08:18 AM
11-12-2005 08:18 AM
Re: Strange Issue With sed command
So if you need to show a tab in this forum, then you'll need to use a numeric representation like the octal 011 or dec 9 for HT, or a control char or the 'od' output with the text. Better still attach a text file with the exact charaters (do NOT cut & paste from screen as again this will mangle tabs)
The sed "1" command can show control characters in the pattern space.
Depending on the shell and such you can enter a true tab only by typing control-v followed by control-i sometimes shown as ^t.
Some versions of sed support \t for TAB or just use that \011
Still... like JRF writes, the command line suggests you are trying to add a space or tab, not replace is. Please clarify. Do you want a tab/spaces added to the output, or removed from the input. In the latter case you'd have to swap the substitue components around (from /x/y/ to /y/x/ )
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2005 11:10 PM
11-13-2005 11:10 PM
Re: Strange Issue With sed command
apart from tab problem, you say
>> Server processes the first document but fails with other files
what is value of ${FILENAME} ?
if you have 3 files
maila mailb mailc
and FILENAME="maila mailb mailc"
the result of
sed -XXX ${FILENAME} > ${FILENAME}.tmp
is
sed -XXX maila mailb mailc > maila mailb mailc.tmp
which might not be what you want.
what you want is more likely
FILENAME=$(any command that list files except .tmp files)
for f in ${FILENAME}
do
sed -XXX $f > $f.tmp
done
Jean-Yves
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2005 04:29 AM
11-14-2005 04:29 AM
Re: Strange Issue With sed command
Are you from BSACET????
Thanks
Vipin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 11:07 PM
11-16-2005 11:07 PM
Re: Strange Issue With sed command
shouldn't that be
ASBECT ?