Find and remove specific text from CSV file with batch file [closed] - csv

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a CSV file with many rows and columns (like an Excel file), I want a batch file that can find 'PaperCut Print Logger - http://www.papercut.com/' from first row-first column and if it exists, removed it.Also i want batch file makes a new CSV without that row and with other content.
Also I want this file to be executed whenever a row is added to the table.
what can i do for that???
i want batch file coding.

if you have to use Batch, there is a single command for that:
find /v "PaperCut Print Logger" <Input.csv > Output.csv
which will technically delete all lines, that contain the string PaperCut Print Logger, but I guess, that fits your needs.
makes a new CSV without that row and with other Content? new Content for the first line only?
echo this is the new first line>Output.csv
find /v "PaperCut Print Logger" <Input.csv >>Output.csv

Related

/Download JSON and only update if there is a change. Can Firebase do this? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I plan on having a massive JSON, ~20MB, and I am creating a React Native App using the JSON. I want to have the app:
Download only the changes to the JSON.
or at least
Download only if changes have been made (which will be less than once a month).
If there is something better than Firebase I would be fine switching over to that.
I had the same issue, a huge JSON object which change once a week. the way that I solved this issue is as following
lets say that we have an object O ~20MB
I created in my firebase db the object data = {raw: O, update: Date()}
on the client side I checked /data/update and compare it to the user localStorage. if it changed I replaced the user`s localstorage object, otherwise skipped.
In this way you dont need to download the whole O only to fetch the date object
it looks like
const {update, raw} = localStorage.fetch('/data')
const last_update = firebase.fetch('/data/update')
if(update === last_update){return raw}
const new_raw = firebase.fetch('/data/raw')
localStorage.save('/data', {update: last_update, raw: new_raw})
return new_raw

Converting E-mail to Names [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am attempting to create a script or figure out a formula that will allow me to do the following.
I am a teacher and often have student use Google Forms for quizzes and different surveys. When grading it I normally split their email. Occasionally some students will have a number after their last name.
firstname.lastname#stu.county.stateschools.us
I would like to take their e-mail and convert it to the following format.
lastname, firstname
This would allow me to sort easily and put into gradebook much faster.
The current best route I know of to do this is to split via . , # then join the data I want.
This takes multiple different columns to complete my task that could very easily overwrite their data. I want this to all take place in one column and get rid of the extra information I do not need.
There are multiple ways to do that. I would probably start with the indexOf() "#"
slice() the string to get the "firstname.lastname"
Next, split() the string to separate the firstname and lastname
Now reverse() the order of ["firstname", "lastname"]
Finally, join() them back together
var email = "firstname.lastname#stu.county.stateschools.us";
var index = email.indexOf('#');
var name = email.slice(0, index).split('.').reverse().join(', ');
// Logs "The student name is: lastname, firstname"
Logger.log("The student name is: %s", name);

Create individual files from 1 CSV [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm extracting data from a MySQL database creating a CSV file with two columns: ID and Text. I would like to know an easy way (SQL, text editor or R solutions) to create a text file for each row containing the second column (text format) with the ID from the first column as the name of the text file. Any ideas? Thanks in advance.
In R I would do the following:
for(i in 1:nrow(df)){
write.table(df$Text[i],
file = paste0(df$ID[i], ".txt"),
col.names = F, row.names = F)
}
list.files()
# [1] "1.txt" "10.txt" "11.txt" "12.txt" "13.txt" "14.txt" "15.txt" "16.txt"
# ----
# "76.txt" "77.txt" "78.txt" "79.txt" "8.txt" "80.txt" "81.txt" "82.txt" "9.txt"
I did a loop based on what you said #Ken S. but it's 90,000 rows that need to be converted into individual files. The R loop is only able to produce 5 per minute, which means it would take several days to finish. Thanks though!
for (i in 1:91020) {number=descriptions[i,1]
text=descriptions[i,2]
print(text)
write.table(text,file=paste0(number, ".txt"))}

how to structure the data in tables format? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I have the following data in .dat format which i opened in excel and it turns out this way
1::Toy Story (1995)::Animation|Children's|Comedy
2::Jumanji (1995)::Adventure|Children's|Fantasy
3::Grumpier Old Men (1995)::Comedy|Romance
4::Waiting to Exhale (1995)::Comedy|Drama
5::Father of the Bride Part II (1995)::Comedy
6::Heat (1995)::Action|Crime|Thriller
7::Sabrina (1995)::Comedy|Romance
I want to structure it in table format like below..
Movie ID Movie Name Year of Release MovieType1 MovieType 2 MovieType 3
1 Toy Story 1995 Animation Children's Comedy
2 Jumanji 1995 Adventure Children's Fantasy
3 Grumpier Old Men 1995 Comedy Romance
and so on..
should i use R for it..or is it possible in excel itself ?
To import the data into an Excel spreadsheet, please try these instructions...
Start Excel.
Choose File --> Open.
Choose Browse...
Change the File Type to "All Files (.)".
Navigate to and select your .dat file.
Choose the Open button.
Choose the delimited option if it has not defaulted to that.
Set the "Start import at row" to the number of the row where your
data starts.
Choose "My data has headers" if appropriate.
Choose "Next".
Unselect any value in the Delimiters collection bar "Other".
Select "Other" if it is not already selected.
Enter a colon into the textbox next to "Other"
Select "Treat consecutive delimiters as one" if not already
selected.
Choose "Next".
Set the column data formats as appropriate.
Choose "Finish".
If you have any questions or comments, then please feel free to post a Comment accordingly.

R Studio Viewer issue [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am running the folliwing code:
trial = read.csv("trial.csv",
header = TRUE,
sep = ",",
na.string = "NA",
skip = 0,
strip.white = TRUE,
stringsAsFactors=FALSE
)
which I've successfully run for 3 previous datasets. No problem, I eventually merged them and did my stuff.
However, on this one I can't understand what's going on: the dataset doesn't open. I've tried to see which column was giving me the problem and it is the sixth
x<-trial[6]
which is the only numeric one. So i thought it was a conversion problem (the string one, even if I put the code in the import one.
But it is not this problem, since when I run
str(trial)
it gives me num, as it should.
It's been a week I've been trying to solve this apparently simple problem but I can't pull though.
EDIT2 The IMF dataset I0m using can be freely downloaded at this link. You need to register (free) to do the bulk download at the top right. I'm not sure if this is the right way to link a dataset, pls let me know.
When you download the dataset, just choose one country (e.g. Italy) and leave the option "all indicators".
EDIT. There is no shown error message.