Skip to main content
16 events
when toggle format what by license comment
Jan 15, 2018 at 4:24 vote accept Aunt Jemima
Jan 11, 2018 at 16:19 history edited Aunt Jemima CC BY-SA 3.0
added link to example input/output
Jan 11, 2018 at 16:13 comment added Aunt Jemima @StéphaneChazelas That sounds promising. I'm researching strace to see how to use it. I've never heard of it before.
Jan 11, 2018 at 7:50 comment added Stéphane Chazelas Try running sed under strace (or equivalent if not on Linux) as in strace sed... or sudo strace sed...
Jan 11, 2018 at 6:36 comment added Philippos what if you do sed 's/ *"/"/g; s/" */"/g; s/","//41' original_file.txt without redirecting the output? Is the desired output printed? This would mean that there is no sed problem, but something that prevents files to get written (without giving an error). Btw, why do you use sudo in the second example? If you are not allowed to write to formatted_file.txt, the sudo doesn't help you, because the redirection > is performed without priviledges.
Jan 11, 2018 at 6:23 comment added Philippos This seems unrelated to any regexp matching issue or whitespace trap, otherwise the try with outputting to formatted_file.txt would duplicate the file, but not create an empty file. I'm not sure whether this is related to sed at all.
Jan 11, 2018 at 6:02 comment added cas please edit your question and add some sample input and expected output, showing a representative sample of good (non-problematic) records and bad records. Remember to anonymise your sample data if it contains any personal or sensitive information.
Jan 11, 2018 at 5:56 answer added cas timeline score: 2
Jan 11, 2018 at 3:41 comment added NickD Maybe the file format is slightly different and the regexes fail? E.g. are the double quotes there? Is the number of columns >= 42?
Jan 11, 2018 at 2:56 comment added Aunt Jemima I just checked in vi. They are spaces; ascii 32 or hex 20.
Jan 11, 2018 at 2:49 comment added Aunt Jemima @Hauke Laging. That's a good idea. I'll check now.
Jan 11, 2018 at 2:49 comment added Aunt Jemima @hegez. Yes. It's the same system. This would have been the third time importing the files and running this command on them.
Jan 11, 2018 at 2:42 comment added Hauke Laging Is it possible that space (0x20) characters have been replaced by tabs (0x09)? You could use \s\s* instead of ` \{1,\}`
Jan 11, 2018 at 2:39 comment added hegez Are you running the command in a system where the same command has worked before?
Jan 11, 2018 at 2:33 history edited Aunt Jemima CC BY-SA 3.0
fixed spelling
Jan 11, 2018 at 2:30 history asked Aunt Jemima CC BY-SA 3.0