PDA

View Full Version : Question CSV find value and delete row



justdream
2023-11-16, 02:36 AM
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

wolverine
2023-11-16, 04:06 AM
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.

phila63
2023-11-16, 10:19 AM
windows = powershell. In the past, I have used the info in this weblink https://stackoverflow.com/questions/24326207/using-powershell-to-remove-lines-from-a-text-file-if-it-contains-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


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

Tomas Delgado
2023-11-16, 11:18 PM
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