Code Monkey home page Code Monkey logo

Comments (4)

bitworm avatar bitworm commented on July 24, 2024 1

I've run into this with sed. Apparently (and I think this was changed recently), sed requires a backup filename option to be specified - notice the empty parentheses. Example below of code that will throw error, and that which will solve it:

throws same error:
sed -i 's|_oldstring|new_string|' test.json

works on OSX 10.11:
sed -i '' 's|_oldstring|new_string|' test.json

from couchdb-dump.

dalgibbard avatar dalgibbard commented on July 24, 2024

Pretty odd; could you throw us the output from:

bash -x couchdb-backup.sh -b -H 127.0.0.1 -d test -f test.json

Be sure to strip out any sensitive information from the output- but that should make it nice and clear what's going wrong :)

from couchdb-dump.

raffi-minassian avatar raffi-minassian commented on July 24, 2024

Thanks for your reply. Here is the output ...

+ scriptversionnumber=1.1.1
+ '[' x-b = x ']'
+ username=
+ password=
+ backup=false
+ restore=false
+ port=5984
+ OPTIND=1
+ lines=5000
+ attempts=3
+ getopts ':h?H:d:f:u:p:P:l:t:a:V?b?B?r?R?' opt
+ case "$opt" in
+ backup=true
+ getopts ':h?H:d:f:u:p:P:l:t:a:V?b?B?r?R?' opt
+ case "$opt" in
+ url=127.0.0.1
+ getopts ':h?H:d:f:u:p:P:l:t:a:V?b?B?r?R?' opt
+ case "$opt" in
+ db_name=test
+ getopts ':h?H:d:f:u:p:P:l:t:a:V?b?B?r?R?' opt
+ case "$opt" in
+ file_name=test.json
+ getopts ':h?H:d:f:u:p:P:l:t:a:V?b?B?r?R?' opt
+ shift 7
+ '[' '' = -- ']'
+ '[' '!' x = x ']'
+ '[' true = true ']'
+ '[' false = true ']'
+ '[' true = false ']'
+ '[' x127.0.0.1 = x ']'
+ '[' xtest = x ']'
+ '[' xtest.json = x ']'
+ file_name_orig=test.json
++ uname -a
++ grep -ci darwin
+ '[' '!' 1 = 0 ']'
++ sysctl -n hw.ncpu
+ cores=8
+ '[' '!' x = x ']'
++ expr 8 - 1
+ threads=7
+ case $attempts in
+ true
++ echo 127.0.0.1
++ grep -c http
+ '[' '!' 0 = 1 ']'
+ url=http://127.0.0.1
++ echo http://127.0.0.1
++ egrep -c ':[0-9]*$'
+ '[' '!' 0 = 1 ']'
+ url=http://127.0.0.1:5984
+ '[' '!' x = x ']'
+ '[' '!' x = x ']'
+ '[' '!' x = x ']'
++ echo http://127.0.0.1:5984
++ grep -ic '^https://'
+ '[' 0 = 1 ']'
++ which curl
+ '[' x/usr/bin/curl = x ']'
+ '[' true = true ']'
+ '[' false = false ']'
+ '[' -f test.json ']'
+ curl -X GET 'http://127.0.0.1:5984/test/_all_docs?include_docs=true&attachments=true' -o test.json
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5363    0  5363    0     0  2647k      0 --:--:-- --:--:-- --:--:-- 5237k
+ '[' '!' 0 = 0 ']'
++ head -n 1 test.json
++ grep '^{"error'
+ ERR_CHECK=
+ '[' '!' x = x ']'
++ file test.json
++ grep -c CRLF
+ '[' 1 = 1 ']'
+ echo '... INFO: File contains Windows carridge returns- converting...'
... INFO: File contains Windows carridge returns- converting...
++ du -P -k test.json
++ awk '{print$1}'
+ filesize=8
+ checkdiskspace test.json 8
+ location=test.json
+ KBrequired=8
+ '[' xtest.json = x ']'
+ '[' x8 = x ']'
+ stripdir=test.json
++ df -P -k test.json
++ tail -n 1
++ awk '{print$4}'
++ sed -e 's/K$//'
+ KBavail=121838972
+ '[' 121838972 -ge 8 ']'
+ return 0
+ tr -d '\r'
+ '[' 0 = 0 ']'
+ mv test.json.tmp test.json
+ '[' 0 = 0 ']'
+ echo '... INFO: Completed successfully.'
... INFO: Completed successfully.
+ echo '... INFO: Amending file to make it suitable for Import.'
... INFO: Amending file to make it suitable for Import.
+ echo '... INFO: Stage 1 - Document filtering'
... INFO: Stage 1 - Document filtering
++ du -P -k test.json
++ awk '{print$1}'
+ '[' 8 -ge 256000 ']'
++ wc -l test.json
++ awk '{print$1}'
+ KBreduction=0
++ du -P -k test.json
++ awk '{print$1}'
+ filesize=8
++ expr 8 - 0
+ filesize=8
+ checkdiskspace test.json 8
+ location=test.json
+ KBrequired=8
+ '[' xtest.json = x ']'
+ '[' x8 = x ']'
+ stripdir=test.json
++ df -P -k test.json
++ tail -n 1
++ awk '{print$4}'
++ sed -e 's/K$//'
+ KBavail=121838972
+ '[' 121838972 -ge 8 ']'
+ return 0
+ sed -i 's/.*,"doc"://g' test.json
sed: 1: "test.json": undefined label 'est.json'
+ '[' '!' 1 = 0 ']'
+ echo 'Stage failed.'
Stage failed.
+ exit 1

from couchdb-dump.

dalgibbard avatar dalgibbard commented on July 24, 2024

Same as #36 - fix has been merged.

from couchdb-dump.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.