Thanks Thanks:  1
Showing results 1 to 4 of 4

Thread: CSV find value and delete row

  1. #1
    Senior Member Reputation: 491
    Join Date
    2008-08-14
    Posts
    2,954


    Default CSV find value and delete row

    Dear Experts,

    do you know any tool or Access Query (script)
    that can find specific value and delete all rows contains it

    *CSV file is big in size and couldn't be open completely in Excel
    Last edited by justdream; 2023-11-16 at 02:45 AM

  2. # ADS
    Circuit advertisement
    Join Date
    Always
    Posts
    Many
     

  3. #2
    VIP Member Reputation: 1849 wolverine's Avatar
    Join Date
    2009-01-16
    Posts
    835


    Default Re: CSV find value and delete row

    Have you tried asking ChatGPT? It is usually very good at these things.

    Here is an example when I asked your question (specific to MS Access)

    In Microsoft Access, you can use a SQL `DELETE` query to delete rows that match a specific criterion. Here's an example of a query that deletes all rows where a specific field matches a certain value:

    ```sql
    DELETE FROM YourTableName
    WHERE YourFieldName = 'YourSpecificValue';
    ```

    Replace `YourTableName` with the name of your table and `YourFieldName` with the name of the field you want to search for the specific value. Also, replace `'YourSpecificValue'` with the actual value you want to search for.

    Here's an example with more concrete values:

    ```sql
    DELETE FROM Customers
    WHERE CustomerID = '123';
    ```

    In this example, the query deletes all rows from the "Customers" table where the "CustomerID" field is equal to '123'.

    Please be cautious when using `DELETE` queries, as they permanently remove data. It's a good practice to create a backup of your database before making significant changes.

    Remember to run the query in SQL View of the Access Query Designer or directly in the SQL window in Access.

  4. Thanks justdream thanked for this post
  5. #3
    Member Reputation: 198
    Join Date
    2013-01-08
    Posts
    103


    Default Re: CSV find value and delete row

    windows = powershell. In the past, I have used the info in this weblink https://stackoverflow.com/questions/...tains-a-string
    linux = grep with -v and pipe the output to a new file i.e. grep -v "text to exclude" filename > newfilename OR use AWK

    Quote Originally Posted by justdream View Post
    Dear Experts,

    do you know any tool or Access Query (script)
    that can find specific value and delete all rows contains it

    *CSV file is big in size and couldn't be open completely in Excel

  6. #4
    Member Reputation: 30
    Join Date
    2010-08-07
    Posts
    187


    Default Re: CSV find value and delete row

    Use pandas dataframe in python its very common this days, you can import the csv no matter the size in a dataframe and then simple search and delete. You can import it with method .from_csv and after manupilation you use method .to_csv and thats it. Lots of information on the internet/chatgpt

Bookmarks

Bookmarks

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •