How can I set the file output location in ogr2ogr? - ogr2ogr

Whenever I use ogr2ogr to convert files the output is saved to the following directory:
C:\Users[UserName]\AppData\Local\VirtualStore
Is there anyway I can set this directory to something else?

You can set the output file location by adding it to the ogr2ogr command arguments; for example:
ogr2ogr -f geoJSON -s_srs EPSG:27700 -t_srs EPSG:4326 c://somedirectory/outputfilename inputfilename

Related

Using regular expression in lftp to ignore some strings from file name

Get specific file with name like abc_yyyymmdd_hhmmss.csv from directory using mget.
Example files in a folder:
abc_20221202_145911.csv
abc_20221202_145921.csv
abc_20221202_145941.csv
abc_20181202_145941.csv
But, I want to ignore hhmmss part. I want to get all files with abc_20221202_*.csv
How to include * in mget.
My code below:
File=abc_
Date=20221202
Filename=$File$Date"_*".csv
// Assume I have sftp connection established and I am in directory //where files with above naming convention are present. As I can //download the file when hardcoding exact file name during testing
conn=`lftp $protocol://$user:$password#$sftp_server -p $port <<EOF>/error.log
cd $path
mget $Filename
EOF`
The script is able to find the file but not able to retrieve it from the server.
But, if I remove * and provide the entire file name abc_20221202_145941.csv it will download the file. Why is * causing issue in retrieving the file
Assuming mget actually accepts regex:
Currently your regexp is looking for files that match abc_20221202_(underscore any number of times).csv
Just add a . before the * so it matches any character after the underscore any number of times before the .csv
Like so:
Filename=$File$Date"_.*".csv
If mget doesn't actually support regex, just use wget instead:
wget -r -np -nH -A "abc_20221202_.*\.csv" --ftp-user=user --ftp-password=psd ftp://ip/*
I think the backtick symbol was causing the problem when using *. Once I removed the ` (backtick) and used below command, it worked fine.
lftp -p $port $protocol://$user:$password#$sftp_server <<EOF>/error.log
cd $path
lcd $targetPath
mget $Filename
EOF
You probably missed an underscore between File and Date. A good way to debug such problems is to enable debug (“debug” command) and command logging (set cmd:trace true)

error: the path "nginx-deployment.yaml" does not exist when I use kubectl apply -f nginx-deployment.yaml

I use kubectl apply -f nginx-deployment.yaml enter image description here
Try giving the full path like C:\YAML\nginx-service.yaml
If the yaml file will be in .txt format then convert it into filename.yaml("in filename, name it as you like").Copy the content of the yaml text document("which creates the error") and paste the content in notepad++ and save the file as filename.yaml.
Open the cmd, then command
"docker login"
after that, change the directory to yaml file located directory
"cd directory path"
here directory path is(C:\Users\ELCOT\job-portal\job portal\filename.yaml).Don't consider this path,it's an example.Type your system directory path .
After changing the directory,command
"kubectl create -f Filenae.yaml"
it will load for few minutes, then it shows
"Filename.apps/flask-node-deployment created" .
The above mentioned instructions will works on windows platform ,not in MAC.

Grep with regex from file in bash script without inclusion of more folders

I have a file containing various paths such as:
/home/user/Desktop/Bash/file1.txt
/home/user/Desktop/Bash/file2.txt
/home/user/Desktop/Bash/file3.txt
/home/user/Desktop/Bash/moreFiles/anotherFile.txt
/home/user/Desktop/text/prettyFile.txt
And I receive a input from user that contains the directory, such as:
/home/user/Desktop/Bash/
And I usually save this expression into regex to find all the files in the directory by grep. However, if the folder has more folders, it includes them as well, but I want to only include the files in the directory that was entered by the user. My desired output is should be this:
/home/user/Desktop/Bash/file1.txt
/home/user/Desktop/Bash/file2.txt
/home/user/Desktop/Bash/file3.txt
But it keeps including
/home/user/Desktop/Bash/moreFiles/anotherFile.txt
which I don't want and I need to do it inside a bash script.
You can use this grep command to get just the files directly under given path skipping sub-directories:
s='/home/user/Desktop/Bash/'
grep -E "$s[^/]+/?$" file
/home/user/Desktop/Bash/file1.txt
/home/user/Desktop/Bash/file2.txt
/home/user/Desktop/Bash/file3.txt

How to enter input to .exe file through command prompt on Windows?

I have a .exe file that I have built from the makefile of a set of source .cpp files.
It should take in a set of inputs and write the output to a .txt file. The manual I am following provides the following instruction for running it on linux:
./xyz -l4 -w6 -k4 -iSampleInputTJU.txt -oMyOutputFile.txt -p
But I need to run it on windows 10. So I typed in:
C:>\Desktop\xyz -l4 -w6 -k4 -iSampleInputTJU.txt -oMyOutputFile.txt -p
However it tells me that it cannot open the input file.
I am not sure what I am doing wrong. Please help. Any input will be appreciated.
To execute a program, regardless of platform. The format shall be:
<Program path> [program arg list]
The path can be relative or absolute.
In your Linux shell. You are running:
./xyz -l4 -w6 -k4 -iSampleInputTJU.txt -oMyOutputFile.txt -p
You are using ./. This means your program is under current directory.
In your windows console:
C:>\Desktop\xyz -l4 -w6 -k4 -iSampleInputTJU.txt -oMyOutputFile.txt -p
You are using absolute path here. You might not run the program under the path which your input file locates. You can type dir to check the current directory see if the input file is there.

Extract file with 7Zlib command line into directory

I would like to extract a file with 7za.exe (Link to download 7za.exe command line).
I can extract with the commands e or x, but my files are extracted in the current file.
It is a mess, that is why I want to specify the destination directory.
I already tried this command but it won't work :
7za e myZipFile.zip myDestinationFolder
7za x myZipFile.zip myDestinationFolder
It says No files to process
Finally I've just find the way to extract my zipped files in another folder !
By default 7z extract files into the current folder...
This allow to extract the files in the c:\soft folder :
7z e archive.zip -oc:\soft *.cpp -r
The trick is that we have to attache the command -o directly before our destination directory ! So beware : no space between the command -o and our destination directory path.