Code Monkey home page Code Monkey logo

anew's Issues

Memory usage

Hi,
Thank you very much for providing useful tools like anew.

I came across the following error

fatal error: runtime: out of memory
...
main.main()
	/root/src/github.com/tomnomnom/anew/main.go:27 +0x546 fp=0xc420feaf80 sp=0xc420feacc0 pc=0x495ea6

Checking further, I can see the memory usage increase when running anew.
Example:

echo "test" | anew file.txt

With a file.txt is 376MB and containing 7 364 495 lines, I can see the memory increase from
138MB to 1.2GB. This is around 3x the size of the file.txt used.

With another test file twice the size and lines, (750MB), Memory goes to 1.6GB (2x the size)

So this make anew difficult to use in some cases ( "big" files and/or low memory like RaspberryPI )

I wonder if there are some possible code modifications possible (or a new option use) to reduce/limit the memory usage (Splitting the file in smaller bits first, write temporary to disk etc... ) even if this impact the time of the operation.. ?

Thank's !

The Upside-anew

I love how anew works. I often find myself doing this, though:

cat things.txt | grep -v -f thingsidontwant.txt | t2.txt && mv t2.txt things.txt

It would be wonderful if I could do:

cat thingsidontwant.txt | anew -invert things.txt

and have anew REMOVE any items that match the input from the target file.

I'm happy to take this on but wanted to open an issue first to see if this would be worth a PR or better suited to a standalone tool.

go1.20.2

Hi, I'm getting compile: version "go1.18.1" does not match go tool version "go1.20.2"

Is there a workaround for this?

Small detail

So 'anew' is 'append new stuff if not already there' right?

i can't install the tool

sudo go install github.com/tomnomnom/anew@latest

internal/unsafeheader

compile: version "go1.17.2" does not match go tool version "go1.17.1"

internal/abi

compile: version "go1.17.2" does not match go tool version "go1.17.1"

internal/cpu

compile: version "go1.17.2" does not match go tool version "go1.17.1"

internal/goexperiment

compile: version "go1.17.2" does not match go tool version "go1.17.1"

runtime/internal/atomic

compile: version "go1.17.2" does not match go tool version "go1.17.1"

runtime/internal/sys

compile: version "go1.17.2" does not match go tool version "go1.17.1"

internal/race

compile: version "go1.17.2" does not match go tool version "go1.17.1"

sync/atomic

compile: version "go1.17.2" does not match go tool version "go1.17.1"

unicode

compile: version "go1.17.2" does not match go tool version "go1.17.1"

unicode/utf8

compile: version "go1.17.2" does not match go tool version "go1.17.1"

math/bits

compile: version "go1.17.2" does not match go tool version "go1.17.1"

internal/itoa

compile: version "go1.17.2" does not match go tool version "go1.17.1"

container/list

compile: version "go1.17.2" does not match go tool version "go1.17.1"

crypto/internal/subtle

compile: version "go1.17.2" does not match go tool version "go1.17.1"

crypto/subtle

compile: version "go1.17.2" does not match go tool version "go1.17.1"

unicode/utf16

compile: version "go1.17.2" does not match go tool version "go1.17.1"

vendor/golang.org/x/crypto/cryptobyte/asn1

compile: version "go1.17.2" does not match go tool version "go1.17.1"

internal/nettrace

compile: version "go1.17.2" does not match go tool version "go1.17.1"

vendor/golang.org/x/crypto/internal/subtle

compile: version "go1.17.2" does not match go tool version "go1.17.1"
med@med:~$ go version
go version go1.17.1 linux/amd64

how to fix it

github.com/tomnomnom/anew

go/src/github.com/tomnomnom/anew/main.go:44:3: non-bool lines[line] (type struct {}) used as if condition

Submission of anew Package for Debian Packaging

Hello everyone,

My name is Marcos R Carvalho (aka oday).

I have initiated the packaging process for anew for Debian. I would like to express my gratitude for the excellent work done by the developers of anew.

I have submitted the package to the mentors repository for review by other Debian Developers (DDs). You can find the package at the following link: https://mentors.debian.net/package/anew/

I can't install

go install -v github.com/tomnomnom/anew@latest No command output is displayed

cant use properly

it is just working on my home dir, i am not able to use it anywhere alse

Entries appended without a new line

I have two files:
first.txt (Doesn't have an empty line in the end)

1
2
3

second.txt

1
2
3
4
5

cat second.txt | anew first.txt

cat first.txt

image

The solution might be to add a new line if previous character wasn't a new line before appending new entries to the file.

anew breaks my cron

I am running some automation. anew is part of it. when running manually it works fine. but somehow, the script breaks when run using cron. I have tried adding and removing anew in the script to make sure the problem. when I add anew, the script breaking after the line where anew is added.
Please check, reproduce and fix :-D

Feature Request: Add a flag to take whitespace into account

Right now, if there's an entry with a trailing space in the file to be appended to, anew will append another entry (without a trailing space) resulting in duplicate entries.

Please consider adding a toggle flag to ignore or not ignore white space when determining if a new entry should be appended.

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.