text-files

How to transpose lines to column for only 7 rows at a time in file

蹲街弑〆低调 提交于 2019-12-06 07:41:24
Please help, I have a text file that looks something like this: ID: 000001 Name: John Smith Email: jsmith@ibm.com Company: IBM blah1: a blah2: b blah3: c ID: 000002 Name: Jane Doe Email: jdoe@ibm.com Company: IBM blah1: a blah2: b blah3: c ID:000003 . . . etc. Notice that each customer's info is in 7 rows. The ID:000002 marks the start of the next customer, 000003 the next customer, so on and so forth. I would like my output file to be like this (instead of each customer's data in the next rows, to have each ID and subsequent 7 rows to be transposed to columns): ID: 000001,Name: John Smith

Tcl/Tk write in a specific line

倖福魔咒の 提交于 2019-12-06 07:02:51
I want to write in a specific line in Textdocument but there´s a Problem with my code, i don´t know where the bug is. set fp [open C:/Users/user/Desktop/tst/settings.txt w] set count 0 while {[gets $fp line]!=-1} { incr count if {$count==28} { break } } puts $fp "TEST" close $fp The File only contains TEST. Has anybody an idea? You are using 'w' as access argument, which truncates the file. So you will loose all data from file while opening. Read more about open command You can use 'r+' or 'a+'. Also To write after a particular line you can move the pointer to the desired location. set fp

Detect newline byte from filestream

£可爱£侵袭症+ 提交于 2019-12-06 05:52:44
I'm trying to collect information from a textfile which contains names of organisations (without spaces) and floating integers. I want to store this information in an array structure. The problem I'm having so far is collecting the information. Here is a sample of the textfile: CBA 12.3 4.5 7.5 2.9 4.1 TLS 3.9 1 8.6 12.8 4.9 I can have up to 128 different numbers for each organisation, and up to 200 organisations in the textfile. This is what my structure looks like so far: struct callCentre { char name[256]; float data[20]; }; My main: int main() { callCentre aCentre[10]; getdata(aCentre);

load textfile in webview android

家住魔仙堡 提交于 2019-12-06 04:28:21
问题 so far i have read how to load "normal" html webpages in a webview .. so far I pass the URL containing the path of my text file but it loads nothing. this is my method: @Override public void onSelected(String url) { ViewerFragment viewer = (ViewerFragment) getSupportFragmentManager() .findFragmentById(R.id.view_fragment); if (viewer == null || !viewer.isInLayout()) { Intent showContent = new Intent(getApplicationContext(), ViewerFragment.class); showContent.setData(Uri.parse(url));

Filter a text file into a new text file

荒凉一梦 提交于 2019-12-06 01:48:34
问题 Sorry about the dummy question here. Under Windows I would like to be able to filter one .txt file into a new one. Filtering all lines that contain a specific string. I know this could well be a really easy one, but would really appreciate a few pointers please. 回答1: Use the findstr command: findstr my-string filename > new-file findstr /? will give you a usage message telling you how to use findstr (including the /V switch if you wanted to filter lines out rather than filtering them in .) Or

progress bar for reading lines in text file

痞子三分冷 提交于 2019-12-06 00:32:38
I'm reading lines form in a text file and then performing actions per line. Due to the size of the text file and the time of each action 500 => seconds. I would like to be able to view the progress but not sure where to start. Here is an example script I'm using, how would write that for this? import os tmp = "test.txt" f = open(tmp,'r') for i in f: ip = i.strip() os.system("ping " + ip + " -n 500") f.close() test.txt: 10.1.1.1 10.1.1.2 10.2.1.1 10.2.1.1 Here's a handy module: progress_bar . It's short and simple enough; read the source for ideas on implementing your own. Here's a very simple

join 3 files by first Column with join (was awk)?

我是研究僧i 提交于 2019-12-05 22:58:37
问题 i have three similar files, they are all like this: File A ID1 Value1a ID2 Value2a . . . IDN Value2n and i want an output like this Output ID1 Value1a Value1b Value1c ID2 Value2a Value2b Value2c ..... IDN ValueNa ValueNb ValueNc Looking to the first line, i want value1A to be the value of id1 in fileA, value1B the value of id1 in fileB, and so on which each field and each line. I thougth it like a sql join. I've tried several things but none of them where even close. EDIT: All files have the

How to get particular line to line from text file and display array list in android

纵然是瞬间 提交于 2019-12-05 22:54:55
I have a text file, and i was able to read the full content and display it on a view. Sample example format for text file :- ## userdetail [William] [Bits] 6th cross road, City house. Rio. <051-22345690>|<002-22345690> ## calldetails income 22. out going 24. missed 21. ## Lorempsum Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book ## userot It is a long established fact that a reader will be distracted

C++ Trouble Reading a Text File

一曲冷凌霜 提交于 2019-12-05 21:30:16
I'm trying to read a text file but nothing is coming out. I feel like maybe It's not linking correctly in my Visual Studio Resources folder but if I double click it - it opens fine in visual studio and it doesn't run into any problems if I test to see if it opens or if it is good. The program compiles fine right now but there's not output. Nothing prints to my command prompt. Any suggestions? Code #include <iostream> #include <iomanip> #include <fstream> using namespace std; int main() { char str[100]; ifstream test; test.open("test.txt"); while(test.getline(str, 100, '#')) { cout << str <<

Why is (foobar>>x) preferred over (! foobar.eof() ) [duplicate]

佐手、 提交于 2019-12-05 20:26:42
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Why is iostream::eof inside a loop condition considered wrong? eof() bad practice? My teacher said we shouldn't use EOF to read in text file or binary file information instead we should use (afile>>x). He didn't explain why, can someone explain to me. Can someone also explain what are the differences in this two different method of reading //Assuming declaration //ifstream foobar ( ! foobar.eof() ) { foobar>>x;