How to manipulate CSV file in sed?

Posted on 2006-05-25
Last Modified: 2008-01-09
I have a CSV file, with 7 values separated by commas.
I want a file that contains only the first value , and another file that contains only the 3rd value .
I have GNU sed, no awk , no perl (this is a windows server).

Question by:shalomc
    LVL 45

    Accepted Solution

    Hi shalomc,

    > I want a file that contains only the first value ,
    sed 's:\([^,]*\).*:\1:' inputfile

    >and another file that contains only the 3rd value .
    sed 's:[^,]*,[^,]*,\([^,]*\).*:\1:' inputfile

    LVL 32

    Author Comment



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Suggested Solutions

    This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
    I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now