Results 1 to 2 of 2
Hi I have a requirement like this: Cut the characters from each line of a file with following positions: 21-24, 25-34 ,111-120. These fields now need to be placed in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-04-2010 #1
- Join Date
- Sep 2010
Pasting multiple cut outputs to a tab delimited output file
I have a requirement like this:
Cut the characters from each line of a file with following positions:
21-24, 25-34 ,111-120.
These fields now need to be placed in a tab delimited output file.
Currently this is how I am achieving it:
cat newsmaple.txt | cut -c 21-24 > out1.txt
cat newsmaple.txt | cut -c 25-34 >out2.txt
cat newsmaple.txt | cut -c 111-120 >out3.txt
paste out1.txt out2.txt out3.txt >out.txt
rm out1.txt out2.txt out3.txt
It does produce the required output but the code does not look clean. Is there a better way of doing this. Also I wish to avoid the 3 temporary outputfiles:
out1.txt out2.txt out3.txt .
Could you please help me on this.
- 09-04-2010 #2
- Join Date
- Jan 2007
welcome to the forum
something like this might work
cut --output-delimiter="\t" -c 21-24,25-34,111-120 <newsmaple.txt >out.txtthe sun is new every day (heraclitus)