I am currently using root for my data analysis in my internship and have a question. I have an Asci file (.txt) and have there about 9000 entries these are not separated with a tab but with a space. Root wants to be able to evaluate it tabs how can I change this ?
*** Break *** segmentation violation
Generating stack trace…
0x00007fcdc99e9046 in from /snap/root-framework/889/usr/local/lib/libCore.so
0x00007fcdc9198090 in from /lib/x86_64-linux-gnu/libc.so.6
0x00007fcdc92e09d3 in from /lib/x86_64-linux-gnu/libc.so.6
0x00007fcdac64e5fa in TGraph::CopyPoints(double**, int, int, int) + 0xa4 from /snap/root-framework/889/usr/local/lib/libHist.so
0x00007fcdac64f9fa in TGraph::ExpandAndCopy(int, int) + 0x7c from /snap/root-framework/889/usr/local/lib/libHist.so
0x00007fcdac655415 in TGraph::SetPoint(int, double, double) + 0x6f from /snap/root-framework/889/usr/local/lib/libHist.so
0x00007fcdc954b228 in
0x00007fcdc954e03f in
0x00007fcdc35669f6 in from /snap/root-framework/889/usr/local/lib/libCling.so
0x00007fcdc34cfeff in from /snap/root-framework/889/usr/local/lib/libCling.so
0x00007fcdc34d2d45 in from /snap/root-framework/889/usr/local/lib/libCling.so
0x00007fcdc35e4271 in from /snap/root-framework/889/usr/local/lib/libCling.so
0x00007fcdc35f3ec5 in from /snap/root-framework/889/usr/local/lib/libCling.so
0x00007fcdc35f5778 in from /snap/root-framework/889/usr/local/lib/libCling.so
0x00007fcdc35dced0 in from /snap/root-framework/889/usr/local/lib/libCling.so
0x00007fcdc327661f in from /snap/root-framework/889/usr/local/lib/libCling.so
0x00007fcdc32770b5 in TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) + 0x8e3 from /snap/root-framework/889/usr/local/lib/libCling.so
0x00007fcdc327acea in TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) + 0xa6 from /snap/root-framework/889/usr/local/lib/libCling.so
0x00007fcdc984e460 in TApplication::ExecuteFile(char const*, int*, bool) at TApplication.cxx:? from /snap/root-framework/889/usr/local/lib/libCore.so
0x00007fcdc984dbbe in TApplication::ProcessFile(char const*, int*, bool) + 0x34 from /snap/root-framework/889/usr/local/lib/libCore.so
0x00007fcdc984d9aa in TApplication::ProcessLine(char const*, bool, int*) + 0xd4a from /snap/root-framework/889/usr/local/lib/libCore.so
0x00007fcdc9c173dc in TRint::ProcessLineNr(char const*, char const*, int*) + 0x332 from /snap/root-framework/889/usr/local/lib/libRint.so
0x00007fcdc9c169d3 in TRint::HandleTermInput() + 0x2e1 from /snap/root-framework/889/usr/local/lib/libRint.so
0x00007fcdc9c13f59 in TTermInputHandler::Notify() + 0x35 from /snap/root-framework/889/usr/local/lib/libRint.so
0x00007fcdc9c18db7 in TTermInputHandler::ReadNotify() + 0x29 from /snap/root-framework/889/usr/local/lib/libRint.so
0x00007fcdc99f2af9 in TUnixSystem::CheckDescriptors() + 0x121 from /snap/root-framework/889/usr/local/lib/libCore.so
0x00007fcdc99f1d56 in TUnixSystem::DispatchOneEvent(bool) + 0x178 from /snap/root-framework/889/usr/local/lib/libCore.so
0x00007fcdc98c96e7 in TSystem::InnerLoop() + 0x45 from /snap/root-framework/889/usr/local/lib/libCore.so
0x00007fcdc98c9458 in TSystem::Run() + 0xf4 from /snap/root-framework/889/usr/local/lib/libCore.so
0x00007fcdc984e631 in TApplication::Run(bool) + 0x61 from /snap/root-framework/889/usr/local/lib/libCore.so
0x00007fcdc9c15d46 in TRint::Run(bool) + 0x8da from /snap/root-framework/889/usr/local/lib/libRint.so
0x00005589275245dd in main + 0x87 from /snap/root-framework/889/usr/local/bin/root.exe
0x00007fcdc9179083 in __libc_start_main + 0xf3 from /lib/x86_64-linux-gnu/libc.so.6
0x000055892752424e in _start + 0x2e from /snap/root-framework/889/usr/local/bin/root.exe
Root >
O.K.
You need to get rid of all “|”, “─”, and “+” characters (and remove the line with “t” and “Phi(t)”).
Then my simple macro will work.
Your file should look like this:
I don’t think there is any need to convert between spaces and tabs.
Anyhow, the easiest would be: sed -i -e '{s/ /\t/g}' myfile.txt # spaces to tabs sed -i -e '{s/\t/ /g}' myfile.txt # tabs to spaces
BTW. The original file could easily be “cleaned” using (if there is no “scientific / exponential notation” used): sed -i -e '{s/[^[:space:]0-9.-]//g}' Aufgabe323.txt