Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6341935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:08:23+00:00 2026-05-24T20:08:23+00:00

I have a CSV document that is of the following structure Headers Path,Publish,Hashlist,Package Content

  • 0

I have a CSV document that is of the following structure

Headers

Path,Publish,Hashlist,Package

Content Entries

C:\packages\word.docx, 10:14:17 on 17-08-2011, C:\packages\word.hash, C:\packages\word.zip

Now, I will have multiple lines of entries, but I only want to maintain one entry per path at a given time. So when I add a new entry for C:\packages\word.docx, I want to find and delete the line above. I can append the .CSV no problem in PowerShell, but am unsure how to identify the line based on the filepath, and remove/overwrite it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:08:26+00:00Added an answer on May 24, 2026 at 8:08 pm

    Something like this maybe:

    $csv = import-csv test.csv
    $tobeupdated = $csv | ?{$_.Path -eq "pathyouarecurrentlyprocessing"}
    if($tobeupdated){
        #update
        $tobeupdated.Publish = "blah blah"
    
    } else{
        #add new
        $tobeupdated = New-Object Object 
        $tobeupdated | Add-Member -type NoteProperty -name Path -value "c:\something.docx"
        $tobeupdated | Add-Member -type NoteProperty -name Publish -value "10:14:17 on 17-08-2011"
        $tobeupdated | Add-Member -type NoteProperty -name Hashlist -value "C:\packages\word.hash"
        $tobeupdated | Add-Member -type NoteProperty -name Package -value "C:\packages\word.zip"
        $csv += $tobeupdated
    }
    
    $csv | export-csv test.csv -notype
    

    The update part maybe tricky based on what you are doing. So it will be helpful if you give some code on what you are doing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my CSV file imported as such: records = FasterCSV.read(path, :headers => true,
I have a CSV string that is embedded within an XML document, which is
I have implemented a csv file builder that takes in an xml document applies
I have a .csv file that is frequently updated (about 20 to 30 times
I have a CSV file that holds about 200,000 - 300,000 records. Most of
I have a CSV data file with rows that may have lots of columns
I have a CSV of file of data that I can load in R
G'day guys, currently have almost finished writing a rails application that allows a CSV
In MongoDB, I have a document with a field called ClockInTime that was imported
I have a CSV-like text file that has about 1000 lines. Between each record

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.