What is the proper syntax for using the DISABLE_FK_CHECK option of the COPY command? - yugabytedb

How do we use the DISABLE_FK_CHECK option in the COPY command?
This does not work:
yugabyte=> \COPY xpctd_prtn_value FROM '/root/data.txt' WITH (FORMAT CSV, DELIMITER '|', DISABLE_FK_CHECK);
ERROR: option "disable_fk_check" not recognized
LINE 1: ...value FROM STDIN WITH (FORMAT CSV, DELIMITER '|', DISABLE_FK...
^
See doc page for reference.
I am running:
yugabyte=> SELECT substring(version() from 'YB-([^\s]+)') AS "YugabyteDB Version";
YugabyteDB Version
--------------------
2.13.2.0-b0
(1 row)
Thanks!

That feature will be available on 2.15.0.0 that should be released next week: https://docs.yugabyte.com/preview/releases/release-notes/v2.15/#v2.15.0.0
See issue details https://github.com/yugabyte/yugabyte-db/issues/12478 for backport status.

Related

what is the proper syntax of gmic apply_video

I am trying to apply a gmic filters using apply_video option of gmic utility for linux .
./gmic --apply_video 'small.mp4','-denoise 30,10' -o convert.avi
but the output is an error in terminal
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Apply command 'small.mp4,-denoise 30,10' on video stream '', with output filename '', first frame 0, last frame -1 and frame step 1.
[gmic] *** Error in ./apply_video/*local/*substitute/ *** Command '-basename': Undefined argument '$1', in expression '$1' (for 2 arguments specified).
[gmic] Command '-basename' has the following description:
-basename:
file_path,_variable_name_for_folder
Return the basename of a file path, and opt. its folder location.
When specified 'variable_name_for_folder' must starts by an underscore
(global variable accessible from calling function).
so what is the correct syntax for gmic --apply_video ?
I am using version 1.7.3
I'm using latest available version 1.7.5_pre, and I use it like this :
$ gmic -w -apply_video input.avi,\"-denoise 30,10\",0,-1,1,output.avi
For G'MIC options, you can use the excellent offline help
gmic -h
or
gmic -h -apply_video
Which as of version 1.7.8 gives
gmic: GREYC's Magic for Image Computing.
Version 1.7.8, Copyright (c) 2008-2016, David Tschumperle.
(http://gmic.eu)
-apply_video:
video_filename,_"command",_first_frame>=0,_last_frame={ >=0 | -1=last },
_frame_step>=1,_output_filename
Apply a G'MIC command on all frames of the specified input video file, in a streamed way.
If a display window is opened, rendered frames are displayed in it during processing.
The output filename may have extension '.avi' (saved as a video), or any other usual image file
extension (saved as a sequence of images).
Default values: 'first_frame=0', 'last_frame=-1', 'frame_step=1' and
'output_filename=(undefined)'.

Renaming files like 20141207_190822.jpg to "2014-12-07 19.08.22.jpg" in linux or MacOS X

How in Linux or MacOS X to rename a bunch of files with names 20141207_190822.jpg and 20141207_190823.mp4 to this format:
2014-12-07 19.08.22.jpg
and
2014-12-07 19.08.23.mp4
?
I've found many examples how to just add something to the beginning of filename, but here I need to change the mask by inserting symbols in the middle of filenames and replacing _ with space " ".
Thank you
Try doing this :
$ rename 's#^(\d{4})(\d{2})(\d{2})_(\d{2})(\d{2})(\d{2})#$1-$2-$3 $4.$5.$6#' *
There are other tools with the same name which may or may not be able to do this, so be careful.
If you run the following command :
$ file $(readlink -f $(type -p rename))
and you have a result like
.../rename: Perl script, ASCII text executable
then this seems to be the right tool =)
If you don't have this command, search your package manager to install it or do it manually
Last but not least, this tool was originally written by Larry Wall, the Perl's dad.

how to edit a file to keep lines of same length only by using shell command

I have a file with contents like below.
7f22cebc9330
600e98
7fff1814ff50
7f22cebc95c0
7f22cebc95b8
4002a8
7f22cebc95bc
You can see that some have 12 characters (eg:7f22cebc9330 ), and some have six (eg: 600e98).
How can I edit this file such that only lines with 12 characters are kept in the file, removing all the lines that are NOT of 12 characters length ?
So that my new file would look like this:
7f22cebc9330
7fff1814ff50
7f22cebc95c0
7f22cebc95b8
7f22cebc95bc
I mean by using shell command in linux.
Thanks.
awk 'length() == 12' input.file > output.file
There are several tools that will allow you to edit the file directly (gnu sed, perl, etc), but doing so is a mistake. Write the output to a new file, and use the shell to rename if necessary.

Bugzilla + Command or Script to add text to parameter 'shutdownhtml' in param file

I am looking for One Line Command or a simple script to set the 'shutdownhtml' in /var/www/html/bugzilla/data/param file.
From...
'shutdownhtml' => '',
To....
'shutdownhtml' => 'Archiving DB and Bugzilla config... It could takes 5 min or longer.',
Did try to use "sed" but somehow the config above has Single Open quote ' , so seem like "sed" not able to do this... ??
Thanks for helping.
Thanks to Thorsten Schöning. A solution has provided by him.
sed --regexp-extended 's/(.)shutdownhtml\1(\s+)=>(\s+)\1{2},/\1shutdownhtml\1\2=>\3\1someText\1,/' params > params.shutdown
See the link below for more information
http://mozilla.6506.n7.nabble.com/Command-or-Script-to-add-text-to-parameter-shutdownhtml-in-param-file-td279974.html

How to delete a particular line which has occurred many times in the file in vim

I want to delete a line: This is an example, which occurs multiple times in a file. How do I go about it.
Thanks,
Alisha
You could do:
:g/This is an example/d
:%s/This is an example\n//gc
% indicates all lines of a file
s indicates pattern to be searched.
g for global replacement
c for confirmation on each replace
If you want to delete the lines containing only the exact match you could:
:g/^This is an example$/d
You can do this using an external command:
:%!grep -v "This is an example"
This filters the entire file through the given command. The grep -v command selects all the lines of the file that do not match the given regular expression.

Resources