How can I use input/output text files in Clion? - clion

I want to import .txt file in my C project in Clion for test if my code is ok.
I want to automate the command that I run in bash:
./<executable_name> < input.txt | diff -output.txt

Related

Cat the contents of a file directly into the clipboard in cygwin terminal

I want to cat the contents of a text file directly into the clipboard rather than display the contents on the screen in a bash terminal in Cygwin.
i.e.,
cat textfile.txt > /dev/clip
I found an easy way to do this is to call the Windows clip program directly:
i.e.,
clip < textfile.txt
Now the text from the file will be available to paste using the mouse right click or ctrl+v.
putclip and getclip
<command> | putclip
or
putclip < <filename>
similar with getclip
They are in the cygutils-extra package
$ cygcheck -p bin/putclip
Found 6 matches for bin/putclip
...
cygutils-extra-1.4.15-2 - cygutils-extra: A collection of simple utilities (other tools
) (installed binaries and support files)
cygutils-extra-1.4.16-1 - cygutils-extra: A collection of simple utilities (other tools
)
cygutils-extra-1.4.16-2 - cygutils-extra: A collection of simple utilities (other tools
)

Execute a python script from terminal that reads an input file from a folder and writes an output file in another folder

I am trying to write a bash script that reads and input .csv file from a folder, execute a python file and write the output file in .csv in another folder. Such that on terminal you can type somthing like this:
inputFolder\input_file.csv | python script.py > outputFolder\output_file.csv.
How can I do this?
Thanks for your help.
You probably want to use an input redirection:
python script.py < inputFolder/input_file.csv > outputFolder/output_file.csv
What OS are you using? \ is the Windows directory separator. Linux uses /

macOS How to read Pages/Numbers file in command line?

macOS How to read Pages/Numbers file in command line ?
I have userd 'cat'
cat /Users/administrator/Downloads/test.pages
but get:
????(??#?-QEQEQEQEQEQEQEQE?kYe??Ȍ?"8?,?9A?i;??1]?????=.SE[????Sqs-?,?iY??3]]QEQEQEQEQEQEQEQE??????(??(??(??(??(??(??(??(??(??(??????(??(??(??(??
addtional
I can use cat to watch .md file
Pages/Numbers files are .zip archives of binary files, not text files. In order to read them on the command line, you'll need a special tool, though I don't believe one exists at the moment

How to merge multiple CSV files into one using terminal on MAC OS?

I have the directory with 20 csv files. They all have same headers. I want to merge these csv files into one file. When I'm working on windows, I just open cmd, go to the right directory and use this command:
copy *.csv combined-files.csv
It does the job on Windows. I can't run this command on mac's terminal as command doesn't exist on Mac. How do I rewrite this Windows command so it does the same job on Mac OS?
Easiest I can think of, which would be similar to the Windows version is:
cat *.csv > combined-files.csv
Note that the headers would be repeated throughout the combined-files.csv if they are contained in all the .csv-files. Just like the solution you posted for Windows.
To concatenate all files into a single file, you can use the following awk command to consolidate the content.
This will ignore the header content though
awk 'FNR > 1' *.csv > consolidated.csv
The awk command assumes that all the files are in one directory.
If all of your files are in different directories, you can use the below command to bring it together into one directory
find . -name \*.csv -exec cp {} newdir/ \;

Can I execute multiple commands store in a text file through bat file

I have a file input.txt which contain multiple commands. I need to use that file as input of my batch file. How can i do this.
cmd < input.txt

Resources