Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

11
  • It is. Since the OP said that there is a unique TAB in between the "word" and the rest of the data. Mind the FS definition! Commented Apr 1, 2015 at 9:31
  • No. I assign the whole $0 (which contains the TAB) to out. Commented Apr 1, 2015 at 9:36
  • The two comments from me look a bit strange now because the one to whom I was replying to deleted his comments. To summarize; the essence is that the presented solution considers all requirements (including to keep data and TAB-separators intact). - That said; I wonder why there was (besides the upvote) also a downvote. Would the voter please add a rationale for that. Commented Apr 1, 2015 at 10:17
  • Seems to be the shortest, but for some reason it fails on many lines. Perhaps because the file contains a lot of utf-8 special characters? Commented Apr 1, 2015 at 10:19
  • With a not too old GNU awk you'd have UTF-8 supported. Is your locale appropriately set? (Something like LC_ALL=en_US.UTF-8.) Otherwise it would be helpful to get some of the sample lines where you see problems; it could also be that the data format is not everywhere as you expected it. Your feedback is appreciated, to track where in the chain of processing the problem lies; somewhere a fix will be necessary. Commented Apr 1, 2015 at 10:27