Programming :: Substitute Few Words + Change All The Lines Starting With A Specific Word + Put Blank?

Jan 17, 2009

I have an old-address-list file which is having around 1500 entries. I need to convert this addresses in to a specific format.

The old-address-list file>
# cat old-address-list-file
dn: CN=Muhammad Hadhi K.M,OU=IT Dept,OU=Example Company H.O,DC=example,DC=com
cn: Muhammad Hadhi K.M

[code]....

View 6 Replies


ADVERTISEMENT

Programming :: Change To Capital First Letter Of Every Word Over Specific Column

May 1, 2010

Trying to change to upper case first letter of every word over a specific column.

View 10 Replies View Related

Programming :: Deleting Lines Above And Below A Word

Mar 25, 2011

i jst want to delete a host entry from httpd.conf the entry for lal.com should be deleted!!

View 14 Replies View Related

General :: Copy Lines Starting And Ending With Specific Pattern From Multiple Files To A File?

Jul 27, 2011

A function by name abc is called in many files. I want to copy all the lines with the function call to an output file.A simple grep on function name doesn't help me as the function call is spanning across multiple lines as follows:

abc(parameter1,
parameter2,
parameter3);

So I want to copy all the three lines (till semicolon) to the output file.The problem is because there are more than 200 calls for the same function and I cannot do it manually

View 2 Replies View Related

Programming :: Printing A Specific Word Out Of A File?

Jan 6, 2011

so i have a file that has the following

file1.txt
ID1 age_11 dog_n3 parent_dog_n1
ID1 age_7 dog_n4 parent_dog_n3
ID1 dog_n5 age_4
ID1 dog_n6 age_4

[Code].....

As you can see i would like the output file to be just the dogs, not the otehr information. But because the information is mixed up how can i extract only the dogs? (i cant do and awk '{print }' because the dogs are found in colounm 2 or 3 or sometimes even 4.

View 9 Replies View Related

Programming :: Delete All Files With Specific Word In Filename?

May 21, 2011

I need a command to find the all files which filename contains the text "SomeText" and to delete that files!From /home/movie/wp-content/uploads/this folder I have lots of files and folders .Also I need that for folders and subfolders who contains some text in folder name "someTextInFolderName"

View 13 Replies View Related

General :: SED - Substitute A Word Only In A Certain Line

Feb 2, 2010

I tried to use the command:

sed -i ''$line_number',/port/s/port/portMARKED/' file

to substitute the word "port" by the word "portMARKED" at the specific line that is saved in "line_number". The substitution happens, but it is copying my line twice... and I have no idea why... I need to make a single substitution of one word for another at a certain line in my text file. Would somebody know how I could do that?

View 3 Replies View Related

Programming :: Awk - Summing Over Specific Lines?

Mar 31, 2011

I'm struggling myself with this problem: I have a file which contains a single column of data

2
.
.
.
45

[code]...

Is there a way to do it with awk?

View 7 Replies View Related

Programming :: Reading Specific Lines From A File?

Sep 10, 2009

To save on the writing of WAY to many files with very little in them, I want to put it all in one file and read a specific few lines. There will be six variables to be read at a time. Format is as such:

//Set 1
string name
5
12

[code]....

From name to 5th number is a set. The name will be of different lengths for each set. This will be a big file of probably 40+ sets. My problem lies in reading one and only one set be it set 5 or set 34. It needs to be done in C++.

View 2 Replies View Related

Programming :: Remove Specific Lines From File

Jan 21, 2011

I'm trying to come up with ideas for a simple way to strip a specific "entry" from a text file.I know tools like sed and perl can remove specific lines from a file but I haven't been able to come up with an elegant way to do my group of lines.In my file, the first "Location" line and the "SVNPath" line should be unique every time... but are they enough to strip out the whole set of the group plus the trailing one line of white space separating each group? Add to this, my file will grow as new entries are added (always appended to the end) but new entries will have the same formatting.

View 9 Replies View Related

Programming :: Make Awk Detect Lines Starting With A Dot?

May 15, 2011

I tried, of course:

Code:

awk '/^./ {print}' FILE.TXT

That does not work, I just get an empty output, even if FILE.TXT contains lines which fit the desired regexp I've searched but did not found my way. I'd like to do it with awk, as I want my program to rely only on awk, nothing else such as sed, grep, etc.

View 12 Replies View Related

Programming :: Blank Lines In A Perl Script?

May 4, 2011

there is a way to add line spaces when asking for user interaction in a script. For example:

Code:

SPACE
Hello what is your name?
SPACE
SPACE

So this is asking a question but has a space/empty line at the top of the screen and 2 spaces/empty lines below. I've seen it done in a bash script using for each line/space needed

Code:

echo ""

So what does perl use?

View 5 Replies View Related

Programming :: Sed - Delete Blank Lines Between Two Patterns?

Jul 28, 2010

I am trying to delete any blank lines within two patterns e.g.

Address: 53 HIGH STREET Cred Id :
MYTOWN
MYCOUNTY
MM12 6MM
Pay Method : Crossed Cheque

The start of my pattern is "Cred Id" and the end is "Pay Method" and I want to delete the blank lines between county and post code. I did find the code below but it doesn't seem to change anything:

sed -ne '/Cred Id/,/Pay Method/!bp' -e '/^$/b' -e -e p ll.out

I can get it to print just the range I'm interested in by doing sed -ne '/Cred Id/,/Pay Method/p'.

View 5 Replies View Related

Programming :: Extract Specific Lines From A Flat File?

Mar 10, 2011

I'm trying to extract specific lines from a flat file. I need lines that fall within a range of coordinates. The -F can be either ! or = If the line is in this set range I need all of the data on that line. ranges lat 36 to 39 and longitude -74 to -84

awk -F '=' '{lat=substr($2,1,2); lon=substr($2,10,3); (lat >36 && lat <39) && (lon >-74 && lon <-84); print lat"--"lon}' < net.log

example line from the flat file
K4MQF-3>APN383,VA2-2,qAR,N3HF-5:!3818.65NS07800.17W#PHG77306/W3,VA3/Clarke Mnt

View 9 Replies View Related

Programming :: Deleting Lines From A File With Specific Pattern Using AWK?

Jun 6, 2010

I have a file which contains milion of records. It contains 12 columns seperated by "||" (delimeter).

First two fields contain first name and last name of a person. Now my requirement is to delete all those records from this file for which:

First two fields does not contain any alphabet.

For e.g i have below mentioned records in file:

gaurav||gandhi||123||456||789
#a%bcd||123abc||89|90||91
12345||@@@||89||123||234
***||!!!!||98||76||90

Now, last two lines should be removed from this file since first two fields does not contain any alphabet for these two records.

View 12 Replies View Related

Programming :: Replace Pattern In Specific Lines And Column With AWK?

Apr 24, 2010

Im tryng to replace in specific column and line number within a file where its 3erd column contain the same string in all lines.

[code]....

My goal is to replace only first and last ocurrences of "Normal player", with the following desired output:

[code]....

Im not sure how to use the "IF" and "AND" conditions together. I�ve tryed with the code below, but the script replaces the string for every line.

[code]....

how to replace values for specific column in first and last lines within same AWK script, without taking reference data in other columns?

View 10 Replies View Related

Programming :: Sed/awk: Three Consecutive Blank Lines In A File - How To Delete Two Of Them

Jun 16, 2010

I have a file with three consecutive blank lines. I want to delete two and keep one.Also, if anyone could direct me towards a guide on regular expressions particularly as they apply to sed, I would be grateful. I am having a hell of a time figuring out the syntax.

View 8 Replies View Related

Programming :: Add Blank Lines Whenever The Value Of A Given Column Alters In A Data File?

Jan 7, 2011

All I want is a command that reads one data file with several columns and prints it in another one.However, whenever the value in one specific column alters, it prints one empty line in the new file. For example, consider the file

2.54000000 2.54000000
2.54000000 2.54000000
2.54000000 2.54000000
2.54000000 2.56000000

[code]....

View 9 Replies View Related

Programming :: Bash Script To Count Number Of Lines With A Specific Property7?

Aug 11, 2010

I would like to parse an input file in which there are two columns per each row. We want to see how many lines are duplicated where we define duplicate to be having the same second field and different first field. For instance if the input file looks like the following:

79874 13131
79873 12309
79820 13131

[code]...

View 10 Replies View Related

Programming :: Regular Expression To Match Lines In A File That Do Not Start With # Or A Blank Space?

Dec 25, 2010

i have a file like this

# comments
#comments
#comments
bla bla

[code]....

i want to grep lines which do not start with # or a blank space. like

bla bla
bla bla

how do i do this? i tried grep --invert-match '^#' which gives lines not starting with # but gives me blank lines too i tried grep --invert-match '^#|^ ' which will give lines not starting with # OR not starting with blank ( which means any line including ones starting with #

View 3 Replies View Related

General :: Count Lines And Words?

Feb 15, 2010

How can I display the no. of lines, words and characters for each file in current directory and in sub directory.

wc . * shows errornous result as there are some executable files in that directory.

View 2 Replies View Related

Programming :: Read Two Files Word By Word At A Time Using Any Loop By Shell Script?

Mar 4, 2010

Well, I am facing one issue:How can i read two files word by word at a time using any loop as i need word by word comparision in shell script?Please let me know pseudo code.

View 14 Replies View Related

Programming :: Bash Shell Script Read File Word By Word?

Jan 21, 2011

I have a output file look like this:
{"test1" : "test2", "test3" : "test4"},

How can I read word by word in each line?This is not working code:

a=0
while read word
do a=$(($a+1));

[code]...

View 14 Replies View Related

Programming :: Bash Read Input Word For Word ?

May 4, 2010

I am pretty new to bash scripting...I am trying to write a script that will take an input and read it word for word and then DO something with it like echo. I have been able to find how to read word for word from a file but I don't know how to do it with input.

I was looking for something like

Code:

exit 0 The input would be A-Z a-z 0-9 and have a single space between each word.

View 2 Replies View Related

General :: Inserting Same Word On Different Lines In Vi

Aug 2, 2011

I am having problem in adding a word in same place on different line in vi editor (/bin/bash).

View 4 Replies View Related

General :: Searching Files For Specific Words Or Phrases

Jan 31, 2011

I have word like initialize_my_var:in sample.php and I included three library files, take it as a.php, b.php, c.php ,I really don't know where my label(initialize_my_var:)definition is present in my library files, is it possible with a pattern matching string to find which library file really have the exact term "initialize_my_var:" , I'm really looking for an exact pattern match.

View 1 Replies View Related

Ubuntu :: Find Word Print Out # Of Lines

Feb 17, 2010

this is driving me crazy. How can i in the terminal, display only the first 5 lines of say dmesg

View 7 Replies View Related

General :: Grep To Select Lines With M In Last Word

Mar 6, 2011

I have a large file in which each line has three or more blank-delimited words. I'd like to code a grep to keep only those lines which have the letter M in the last word. the M (if present) will be the first character in the last word.

View 14 Replies View Related

Ubuntu :: Select Lines Containing Word And Copy To Another File?

May 31, 2011

I am trying to find a way to search a text file for a certain keyword and then select each line containing the word , copy and paste these lines into another text file. I can do this easily with UltraEdit but I cannot figure out how to do it in Jedit or Scite.

View 5 Replies View Related

Ubuntu :: Opening Word Docs - Brings Up Is Lines

Jul 19, 2011

I took all my docs of my pc and put them on a usb drive and now have moved them onto ubuntu. However, when I open them with openoffice, all it brings up is lines and lines like this... how I can fix this and get my documents back to normal again?

View 3 Replies View Related







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