line-numbers

Bash while loop to compare two files and print line number

▼魔方 西西 提交于 2019-12-24 14:24:57
问题 I have file1: A B C D I have file2: B C I want to use a while read loop to go through both files compare them and print out the line number of file1 for any matching lines. COUNT=0 while read line do flag = 0 while read line2 do COUNT=$(( $COUNT + 1 )) if ( "$line" = "$line2" ) then flag = 1 fi done < file1 if ( flag -eq 1 ) then echo $COUNT > file3 fi done < file2 However I get an error: B command not found Please could someone let me know where I have gone wrong. Thanks. 回答1: There are

PHP Fatal error on line number that doesn't exist

两盒软妹~` 提交于 2019-12-24 02:43:18
问题 Fatal error : Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /Library/WebServer/Documents/XMLDataStore.class.php on line 981 The curious thing about this error is not the memory leak, which would be easy enough to troubleshoot. Rather, it is the fact that XMLDataStore.class.php is only 850 lines long, which I have verified in multiple text editors. This is with the PHP 5.3 bundled with Snow Leopard. I'm not using an opcode cache. Here is my php.ini: allow

Parsing a css file with java

霸气de小男生 提交于 2019-12-23 03:18:34
问题 First I want to explain what am I doing and then my problem. I need to scan a css file and obtain all its internal links(images mainly), but I need to get the line number where the links were found. Right now I am parsing the files using flute library and it works very well also I am using LineNumberReader in order to obtain the line number where a link was found, but this class throws an incorrect line number. For example: the link ../../image/bg.gif is in the line number 350 but the method

How to access line numbers when wrapping Firebug (or similar) Console api

浪尽此生 提交于 2019-12-22 03:55:49
问题 I have wrapped the console API to provide granular logging levels as well as few other sugar features. This works fine, the only problem is that firebug (or whatever other console) will always report the line number the log came from as the line the console API itself is invoked. How would you suggest I make the console log the line number at which I call my wrapper function? I would prefer a cross browser solution but failing that a firebug plugin could be a good start. fyi I call my loging

how to print out line number during application run in VB.net

谁说我不能喝 提交于 2019-12-20 04:38:32
问题 I would like to print out my debug message with line number in VB.net application. I did like this, Dim st As StackTrace Dim sf As StackFramee st = New StackTrace(New StackFrame(True)) sf = st.GetFrame(0) Console.WriteLine.("Line " & sf.GetFileLineNumber()) I wanna put the snippet to a class, everytime I call logMsg method to log my message with line number in source code. But I found if I put the snippet above into a class, the line number was always same, that's the line which I new 'st'.

Get line number from a file

陌路散爱 提交于 2019-12-20 03:40:33
问题 How can I implement a method to return the line-number of the line currently being scanned from a file. I have two scanners, one for the file (fileScanner) and another for the line (lineScanner) this is what I have, but I don't know if I need the linenumber in the constructor! public TextFileScanner(String fileName) throws FileNotFoundException { this.fileScanner = new Scanner(new File(fileName)); this.lineScanner = new Scanner(this.fileScanner.nextLine()); this.lineNumber = 1; } and I need

How to get surrounding method in Java source file for a given line number

主宰稳场 提交于 2019-12-18 11:57:45
问题 I have a line number of a Java source file and want to get the sourounding method for that line number programatically. I looked into ANTLR which didn't help me much. Janino (http://www.janino.net) seems promising, I would scan and parse (and if necessary compile) the code. Then I could use JDI and ReferenceType.locationsOfLine(int lineNumber) Still I don't know how to use JDI for doing this and didn't find a tutorial that goes anywhere in this direction. Maybe there is some other way that I

How to make phpstorm display line numbers by default?

南楼画角 提交于 2019-12-18 09:56:31
问题 How to make phpstorm display line numbers by default? Couldn't find that option. It's kind of annoying to turn them on manually for each page. 回答1: Settings (or Preferences if you are on Mac) | Editor | General | Appearance and check Show line numbers . 回答2: Just now found where is it on Windows . Its View -> Active Editor -> Show Line Numbers (changes only for current document) and File -> Settings -> Editor -> Appearance -> Show Line Numbers (for all documents) For Mac Version go to

Git diff with line numbers (Git log with line numbers)

拜拜、爱过 提交于 2019-12-17 21:42:24
问题 When I do a git diff or a git log -p , how do I get line numbers of the source file(s) inlined with the output? I tried to look it up man git-diff | grep "line numbers" and I tried googling but got nothing quickly. 回答1: You can't get human-readable line numbers with git diff There aren't currently any options to get line-numbers displayed vertically on the side with git diff . Unified-diff format That information is available in the (c)hunk headers for each change in the diff though, it's

vim line numbers - how to have them on by default?

纵饮孤独 提交于 2019-12-17 21:24:43
问题 I can :set number from within a file I'm editing but how can I have them always be on by default? 回答1: Add set number to your .vimrc file in your home directory. If the .vimrc file is not in your home directory create one with vim .vimrc and add the commands you want at open. Here's a site that explains the vimrc and how to use it. 回答2: To change the default setting to display line numbers in vi/vim: vi ~/.vimrc then add the following line to the file: set number Either we can source ~/.vimrc