If I have a CSV file..

Associate
Joined
24 Jun 2008
Posts
1,168
So, I turned up and found out they were running Macs. Woops :p

The batch file worked a treat @SimonCHere I'll file that! How easy would it be for it to add a first line as 'File Name'? :)

Sooo, for Macs then what can I use? How do you use those Python scripts @Hades ? :)

no checking, error handling or anything but it prompts for file name and extension and then creates a new file.

Code:
@echo off
set /P fname="Enter filename: "
set /P ext="Enter extension: "
setlocal enabledelayedexpansion
for /f "tokens=*" %%a in ('type %fname%') do (
set line=%%a
echo !line!.%ext% >> modified_%fname%
)

Interestingly if you have Notepad++ you can do a search/replace of the new line character to get the same result.
If you use
"Extended" in the "Search Mode" you can use
"Find what: " \r\n
"Replace with: " .mov\r\n

@Hades You might want to tell him how to stop your python running as well!
 
Soldato
Joined
18 Oct 2002
Posts
10,058
This can be done in about 2 seconds Sublime text. Open the csv... Select every single one and the just Shift End... All files will be selected with a type flashing line and you can type the same thing on every line in one go. Done...
 
Soldato
Joined
14 Dec 2005
Posts
5,007
a related question...

when I download a bank statement and open in excel...say the description is in B2 and the amount in C2. How would you find out how much you'd spent in Tesco (or whatever!) within all the cells in the file?

just now I do a 'find all'...highlight the cells with 'Tesco' then just manually go through them...fairly sure there's a simple solution :)
 
Associate
Joined
31 May 2007
Posts
1,086
This is one line in a shell on Linux or MacOS. Surely you can do something similar in power shell on windows these days?

Code:
[root@nuc ~]# cat file.csv
name1
name2
[root@nuc ~]# cat file.csv | while read line; do echo $line.mov; done
name1.mov
name2.mov
[root@nuc ~]#
 
Soldato
Joined
18 Oct 2002
Posts
10,058
a related question...

when I download a bank statement and open in excel...say the description is in B2 and the amount in C2. How would you find out how much you'd spent in Tesco (or whatever!) within all the cells in the file?

just now I do a 'find all'...highlight the cells with 'Tesco' then just manually go through them...fairly sure there's a simple solution :)
There's a filter option, you can filter the row based on a cell. So if the cell contains tesco only those rows will be visible.
 
Back
Top Bottom