71422

Text de-justification to get correct substring

Question:

I have a text file which is made up with justify (all tabs aligned - different size).<br /> Therefore I can't get the desired value at a certain column (substring).<br /> Since this is a migration I can't change the format of the file.

How can I "de-justify" the text to spaces while preserving the spacing length, any scripts out there?

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/ErbxK.png" data-original="https://i.stack.imgur.com/ErbxK.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/W85ue.png" data-original="https://i.stack.imgur.com/W85ue.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

I need the upper value. replacing \t with a fixed value doesn't help.

*EDIT: files seems to be formatted with <a href="http://linux.about.com/library/cmd/blcmdl1_fmt.htm" rel="nofollow">fmt</a>

*EDIT2: Solution found it seems; when I use fmt on windows (<a href="http://gnuwin32.sourceforge.net/packages/coreutils.htm" rel="nofollow">coreutils</a>) it stays the same.<br /> However on my mac I get the desired result (maybe something in the win command not setup right).

fmt original_file >> new.txt

Grts

Answer1:

There's probably lots of other ways to do this, but sublime text has built in tab to space conversion.

<a href="http://css-tricks.com/changing-spaces-tabs-sublime-text/" rel="nofollow">http://css-tricks.com/changing-spaces-tabs-sublime-text/</a>

Recommend

  • How to search (case-sensitive) for files using Java glob pattern?
  • WPF Slider control (NullReferenceException)
  • regex - wrap all integers in double quotes
  • Possible to use CodeIgniter output compression with to display code blocks?
  • spark udf with data frame
  • How to parse given date string using moment.js?
  • Find text(A) and replace it with text(B) + HTML
  • BufferedImage rotated, change resulting background
  • Simplifying the use of meshgrid in Matlab
  • Imagemagick set interline spacing?
  • Pandas multi-index subtract from value based on value in other column
  • creating password field in oracle
  • Preserving existing text when writing to file
  • Use neo4j server instead of embedded mode
  • Automapper missing type map configuration or unsupported mapping
  • Updating and removing unique join relationships in CakePHP
  • Are there any libraries for Python to simulate keyboard action?
  • python: forcing relative imports to search from script file
  • Python 3.2.2, error(scripts to exe)
  • Validate jQuery plugin, field not required
  • Pass Dictionary to Javascript array
  • Reading a file into a multidimensional array
  • Query to find the duplicates between the name and number in table
  • preg_replace Double Spaces to tab (\\t) at the beginning of a line
  • Test if a set exists before trying to drop it
  • How to do unit test for HttpContext.Current.Server.MapPath
  • Avoid links criss cross / overlap in d3.js using force layout
  • Fetching methods from BroadcastReceiver to update UI
  • Symfony2: How to get request parameter
  • GridView Sorting works once only
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • retrieve vertices with no linked edge in arangodb
  • WPF Applying a trigger on binding failure
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Change div Background jquery
  • apache spark aggregate function using min value
  • Append folder name and increment by 1 using batch script
  • Busy indicator not showing up in wpf window [duplicate]