• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Stream Files and End-of-Line Delimiters, Take Three

    November 15, 2006 Hey, Ted

    I do a bit of development in Cygwin under Windows and then move it to the iSeries using Qshell. It turns out that Qshell doesn’t like the carriage-return/linefeed combination (CRLF) in shell scripts, so I often need to change CRLF to LF–as you wrote about in two previous articles–in bulk. Here are some methods I use to convert end-of-line delimiters in stream files.

    The first method is a simple Perl command.

    perl -i.bak -pe 's/rn/n/g' * 
    

    This command adds the extension .bak to the end of the files and strips the CRLF, putting in LF instead. By using a wildcard, I can convert a whole directory at a time rather than one file at a time. One could just as easily handle a single file by changing the wildcard at the end from * to the name of the file that one wants to convert.

    Another way is to use a Qshell script like this one, which I call dos2unix, after the Linux command of the same name:

    #!/bin/bash 
    
    # Replace CRLF with LF 
    
    E_WRONGARGS=65 
    
    if [ -z "$1" ] 
    then 
    echo "Usage: `basename $0` filename-to-convert" 
    exit $E_WRONGARGS 
    fi 
    
    file="$1" 
    sed 's/rn/n/g' $file > $file.fixed 
    cp -f $file.fixed $file 
    rm -f $file.fixed 
    

    An alternative to sed is tr:

    tr -d 'r' < $file > $file.fixed 
    

    –Buck Calabro

    Thanks, Buck. I appreciate the solutions. Little junk like this tends to eat up my day.

    –Ted

    RELATED STORIES

    EDTF and End-of-Line Delimiters

    EDTF and End-of-Line Delimiters, Take Two

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    ARCAD Software

    Are you ready for AI on the IBM i? Optimization and guardrails. . .

    what you need to know today

    with Jeff Tickner

    As organizations assess the role and impact of AI, they must make informed choices, particularly around implementing guardrails to ensure secure and controlled usage.

    In this Lunch & Learn session, Jeff Tickner, CTO North America of ARCAD Software, and Alan Ashley, Sr. Solution Architect, will explore how to effectively prepare for the adoption of AI in IBM i environments.

    This session will cover key AI considerations, including:

    • Preparing source
    • Defining security rules and ensuring data privacy
    • Leveraging MCP Servers for optimization

    A deeper dive will also address:

    • The use of MCP Servers with BOB and other AI assistants
    • ARCAD’s approach to integrating AI into DevOps processes through MCP

    Register Now!

    By registering for this session, I acknowledge that my contact information will be shared with the sponsor, ARCAD.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    Patrick Townsend & Associates:  Alliance AES/400 - database field encryption
    New Generation Software:  Leading provider of iSeries BI and financial management software
    COMMON:  Join us at the Annual 2007 Conference & Expo, April 29 - May 3, in Anaheim, California

    Create Database Files from SQL Queries Admin Alert: Three Steps to Mapping iSeries Data to a Windows Network Drive

    Leave a Reply Cancel reply

Volume 6, Number 41 -- November 15, 2006
THIS ISSUE SPONSORED BY:

T.L. Ashford
iTera
WorksRight Software

Table of Contents

  • Create Database Files from SQL Queries
  • Stream Files and End-of-Line Delimiters, Take Three
  • Admin Alert: Three Steps to Mapping iSeries Data to a Windows Network Drive
  • Get Creative Using the SQL Database Exit Point
  • Finding Large IFS Directories
  • Admin Alert: The Rule of Fours for i5 Test Environments

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Power Systems Still Waiting For The GenAI Bump
  • The IBM i and the Hybrid Cloud World: Things To Keep In Mind
  • CData Adds Db2 for i Support to CDC Tool
  • As I See It: The Cost of Having Ethics
  • Brace Yourself: Another Power Systems Price Hike Coming May 1
  • Updates Announced for IBM i BRMS And SMTP Email Client
  • AI Will Be Front And Center At POWERUp 2026 Next Week
  • IBM i PTF Guide, Volume 28, Number 16
  • Spring IBM i Tech Refreshes Will Come A Bit Later This Year
  • You Are Much More Than Power Systems, And So Are We

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle