Software :: Finding The Right File With Only A Line And Column Number?

Aug 1, 2011

I tried to come up with a thread title that was specific without being too long or cryptic. Don't think I succeeded. In my PHP error log I keep getting this error over and over again:

Code:

EntityRef: expecting ';' at line 565, column 81

It's very odd to me that it doesn't contain any sort of stack trace or file info. I know which of my virtual hosts and therefore which directory it's coming from, and it's happened now on half a dozen different servers that this site has lived on. So obviously I'm trying to track it down and add the missing ';' to the right file. This directory has dozens of sub-directories and hundreds of files though.

This is the best I've managed to come up with so far:

Code:

find . -type f -iname "*.php" -print -exec awk 'NR==565' {} ;
(I've run it both with and without the -iname filter.)

I get a very large list of files, and some of them display the contents of line 565 after them. I've checked through a number of them there, but haven't found the culprit. Is it possible to limit my "find" command to only files that have at least 565 lines? Is it possible to have it only print matches from line 565 that has at least 81 columns? How would I modify that to print perhaps 5 lines on either side (in case the error reporting is pulling a slightly different line.)

View 3 Replies


ADVERTISEMENT

Programming :: Create File Listing In C++ That Will Generate Line Number On Every Line Of Code

Apr 11, 2010

I have a project due for my Intro to C++ class and we are suppose to generate a file listing that will take an input of a C++ source code with .cpp extension and make a copy of it with a .lst extention that will have a line number preceding each and every line.

View 12 Replies View Related

General :: Unix Ps -l Priority Whoes One Number In Column "PRI" But In Same Time Ps -o Pri Shows Another Number?

May 21, 2011

Why does unix ps -l whows one number in column "PRI" but in same time ps -o pri shows another number? cpu and nice are zero for those processes

View 1 Replies View Related

Programming :: Adding Number And String To Each Line In Data File

Apr 10, 2010

I have a very large data file, with 3 numbers in each line, ex. 3 4 5 ; 6 7 8.I want to add two numbers (0 and 1) at the end of every line, and a string at the beginning of the line. Does anyone know a efficient way to do so?

View 7 Replies View Related

Programming :: Insert Line Using Sed Or Awk At Line Using Line Number As Variable

Jul 25, 2011

I want to insert a line at a particular line number using sed or awk. where line number is not fixed and is in form of variable.

I want to use variable in sed or awk command.I tried something like below, but no luck.

View 7 Replies View Related

General :: Getting The Line Of String From Previous Pipe Output By Line Number?

Feb 8, 2010

After running the following command, I get:

[root@yukiko /]# find / -iname .bashrc
/home/clamav/.bashrc
/home/vpopmail/.bashrc
/etc/skel/.bashrc
/root/.bashrc

But I would like to have a command that prints a specific line by supplying the command with the line number, for example:

[root@yukiko /]# find / -iname .bashrc | getline(2)
/home/vpopmail/.bashrc

Is there such a command on CentOS?

View 3 Replies View Related

General :: Sort By Line Size (number Of Characters In A Line)?

Jan 8, 2010

I want to sort a number of lines based on their size:

data:
-------
12345678
87654321
1234

[code]....

Should output as:
-----------------
1
2
12
21

[code]....

But i'm gettings this with sort
----------------
1
12
123
1234

[code]....

Can we sort the above "data" text, based on "number of characters" instead of "character order"?

View 8 Replies View Related

General :: How To Delete A Line At Specific Line Number

Jun 15, 2010

I m writing a script to delete a line at particular location.

But i m unable to use variable for specifying line number.

For example.

Code:

works fine and deletes 7th line from my file

But

Code:

gives following error.

Code:

View 7 Replies View Related

Programming :: Perl Script To Replace Line After Finding Previous Line

Feb 28, 2011

At the moment I have a flat file which is being used by a few people. I want a script to remotely change the file, so I can start logging who is doing what.At this point here is one requirement I am trying to develop. We have text blocks who pretty much look like.I hope this is somewhat clear. I try to find $param for the right $workflow and change that. Can you help me to find $$var3 and change that?

View 1 Replies View Related

Programming :: Add Text Before Line Number In Text File?

May 3, 2010

a sed command to add a text before line number in text file? I have text file with 500 lines, and i want to add 3 more lines with text after line 300, OR before line 302, isn't no problem.

View 16 Replies View Related

Programming :: How To Enter Mode Column From Command Line

Mar 3, 2009

I like running sql queries from the command line.

Code:
sqlite3 foo.db "select * from some table"
How can I specify

Code:
.mode column
at the command line?

View 1 Replies View Related

General :: Sed - Print Line Number Along With The Line?

Jan 30, 2011

I want to print the line number with the pattern of the line on a same line using multi-patterns in sed. But i don't know how to do it. For example, I have a file

abc
def
ghi

I want to print

1 abc
2 def
3 ghi

View 6 Replies View Related

General :: Delete/grab A Line Which Matchs A Pattern Of A Particular Column Only?

Jan 18, 2010

I have found many information about how to delete/grab a line in a text file including delete line with match a pattern but I did not find info about how to delete a line which match a pattern of a particular column only.

for example mydata.txt:
id type x y z
1 6 0.474611 0.227223 0.583947

[code]....

View 6 Replies View Related

Ubuntu :: Text Editor Column Editor And Regex Search/replace, Incrementing Number Insert?

Jul 25, 2011

On windows I really only used Notepad++ as my text editor, it had two features that I loved.What I need to accomplish is what I would do with Notepad++ column editor.I could have like 100 lines, and place the cursor at a column, and goto edit>column editor, and I could insert an incrementing number. (I could also pad the incrementing number with 0s, this was GREAT for making batch files among other things.)So each line at that column had a number higher than the previous line.The other feature that I used sometimes was a search/replace with regex patterns.Does anyone know of an editor that has those features for linux? I am mostly after the column editor insert feature but if you know of one with both features that would rock.

View 1 Replies View Related

Fedora :: ERROR: Exception Loading Options: No Element Found Line: 1 Column: 0

Jun 8, 2011

Code:

ali@localhost ~]$ k3d
ERROR: Exception loading options: no element found line: 1 column: 0
WARNING: Resetting options data to version 4
(k3d:12030): GdkGLExt-WARNING **: cannot load PangoFont
Segmentation fault (core dumped)

View 2 Replies View Related

Fedora :: Finding A Free X Display Number?

Mar 9, 2010

how to find a free X display number?

I am using Xephyr to create a windowed session for logging in as another user. It needs its own X display, though. Obviously I can just give it :1.0 and hope for the best, that it would be better to identify the first free display and use that.

But I don't know how...

View 2 Replies View Related

Programming :: Finding A Number In Windows Like The Inode

Aug 19, 2010

anyone know that the ntfs's file sytem struct? is there's a API or something other could let me get this number? Or there is actually no such number in windows like the number of inode in linux?

View 1 Replies View Related

Hardware :: Tool - Finding The Mainboard Serial Number?

Jan 15, 2011

Which linux tool can find out mainboard serial number?

View 5 Replies View Related

General :: Finding A Command For Going Back A Number Of Steps In A Directory Without Using Cd?

May 10, 2011

I'm constantly going 'cd ../../../../'. Is there a command/alias that could let me go 'cmd 4' and I'd be taken back 4 directories?

View 8 Replies View Related

General :: Calculate 3rd Column Which Should Be Addition Of Value In 1 And 2nd Column?

Jul 19, 2010

How would i calculate following values.Initial file

10 3
20 4
How would i calculate 3rd column which should be addition of value in 1 and 2nd column.File after calculation
10 3 13
20 4 24

View 14 Replies View Related

Programming :: Awk Multiple Column Into Single Column?

Jul 15, 2010

I have a multicolumn datas, like

a1 b1 ... f1
a2 b2 ... f2
. . ... .

[code]...

I would like to make a file with all these data in one column, like

a1
a2
.
.

[code]....

Can it be done with awk or some other command? Also, is it possible then do add another column in front of this one with numbers of the lines (for every previous column), like

1 a1
2 a2
. .
. .

[code].....

View 14 Replies View Related

Programming :: Access A File Line By Line, And Check The Length Of Each Line.

Feb 13, 2011

I want to access a file, and check the length of every line.After, i want to check and replace all lines with length over 10 characters, with a message.Does anyone have a clue on that?

View 1 Replies View Related

Programming :: How To Run Code On Certain Line Number In AWK?

May 9, 2010

I want to be able to run a piece of AWK code on a record specified by number, not by a regex.

View 6 Replies View Related

General :: File Name In Separate Column?

Apr 26, 2010

I have some series of files, which actually named bellow

<day_month_yr>_<hh:mm:ss>.<host_name>.<IP.ip.ip.ip>.<log_name>.txt

I want to show this file name below the column may be

Date Time Host_Name IP_address Login_Name
----- ---- --------- ---------- ----------
<day_month_yr> <hh:mm:ss> host_name x.x.x.x log_name
...

View 5 Replies View Related

Software :: Swap The First And Second Column In A File?

Feb 3, 2011

I have a file in the following format

item1 item2 attrbute1, attribute2, line1
item1 item2 attrbute1, attribute2, line2
item1 item2 attrbute1, attribute2, line3
item1 item2 attrbute1, attribute2, line4
item1 item2 attrbute1, attribute2, line5

Question: what command can I use swap item1 and item2 around and keep the attributes in place.
A space seperates the first and second column. The file has many hundreds of lines in which these need to be swapped

Output needs to be as follows:

item2 item1 attrbute1, attribute2, line1
item2 item1 attrbute1, attribute2, line2
item2 item1 attrbute1, attribute2, line3

View 3 Replies View Related

Programming :: Bash Awk Column To End Of File?

Sep 4, 2010

Code:

#!/bin/bash
ls -lhGg | while read line; do echo "$line"; done | awk ' { print $3" "$6 } '

what i want to do is be able to print column 3 and every column greater then 5. Has to be to the end of the line, since different filenames can have different amounts of words in them and the blank space is the separator. my current code works just fine if the file has no blank space.

View 8 Replies View Related

Programming :: Add A Column To A Text File?

Apr 28, 2011

I have a text field that is just list of servers and I need to add the word hostname in front of them... It must be brain fart but I can't think of how to do this. Basically I need this:

server1
server2
server3

To this:

hostname server1
hostname server2
hostname server3

(And I just mean simply the word "hostname")

View 2 Replies View Related

Programming :: Count The Number Of Slashes In Each Line?

Jan 18, 2010

I have a file with lines that look like this:

Dev/7_Texas2004/4_Caves/page.htm
Dev/7_Texas2004/5_SanMarcos/page.htm
Dev/7_Texas2004/6_Austin/page.htm

And I'm trying to count the number of slashes in each line. I figured (with my limited knowledge of bash) that the best thing to use would be sed. So I ran this to print "not /": sed '!s////g' file # and eventually adding " | wc -m" to it. and I got the same result as if I ran cat, no modification at all:

[Code]...

View 7 Replies View Related

General :: Extract 5th Column From A File Without The Header?

Oct 15, 2010

How can I extract 5th column from a file without the header.

View 5 Replies View Related

General :: How To Redirect The Output To Different Column In .csv File?

Apr 25, 2011

I was trying to redirect the output of two variables to different columns of a .csv file in MS excel like this,

Code:
echo "$a $b" > abc.csv
But I am getting both $a and $b in the same column, is there anything I can use instead of to move the value of $b to the next column? Or is there a good different approach to do it?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved