[SOLVED] splitting every word in a text file to a new line.
location: linuxquestions.com - date: May 24, 2012
splitting every word in a text file to a new line, so that i can count the occurance of a given word.
HERE IS MY PROGRAM TO COUNT SPECIFIC GIVEN WORDS:
#break all the sentences into words and save to @words.
print "$wordtomatch appeared $count times\n";
the program works but it counts only one given word from a sentence,
if there is a word -then no problem it will count
but if there are more than one words(the same words to be counted) in the same sentence, the program will count the first word from the sentence and move on to the next sentence.
so i want all the similar words(weather on new line or on the same sentence) to be counted accurately.
Remove New Line or Carriage return from Text File
location: linuxquestions.com - date: September 28, 2007
I have been running a very successful script removing URLs (grep and cut) from emails from my ebay favorites. In the last week or so the width of the emails that I have been receiving has narrowed to the extent that the URL now falls over 2 lines:
Item title:=09Dragon 1/6 Scale MODERN British SA80 Rifle MDRW0020
Item URL: http://cgi.ebay.co.uk/ws/eBayISAPI.d...m=3D130156919=
Buy It Now price: =A36.99
End time: 04-Oct-07 21:58 BST
The current script just pulls off the 1st line and the subsequent wget errors out.
I have tried awk, sed and tr in an attempt to remove the = sign and then the NL or CR. The = signs is easy but I am not having any luck joining the two lines up. I'm guessing that it is just an NL or CR. In vi or gedit it is not a problem to remove the NL or CR.
Any pointers please.
[SOLVED] replace space with new line in vi
location: linuxquestions.com - date: July 30, 2008
how to replace every space with newline?
For example, if I have "i want to go to school", i want to convert it to
I try :%s/ /\n/g , but it does not seem to work
Also is there a way to count the number of space or number of word within vi?
Bash Script, no new line for echo command
location: linuxquestions.com - date: November 4, 2005
I need my script to show a percentage, I'd like the percentage be updated on the same line so that I can display some other information as well.
The echo is inside a loop.
Also.. is there a simple way to figure out how long the command took to execute?
how to remove new line in bash using echo
location: linuxquestions.com - date: November 24, 2009
I created a simple bash script. My primary concern is how to remove the new line in the output of my script in /root/test.txt
Batch Change ^M to New Line
location: ubuntuforums.com - date: May 18, 2010
This feels like a very basic question but I can't seem to get it to work at all... I have a directory full of files from DOS, *NIX, MAC, whatever else. I want to go through each file, look for the ^M (control-m) character and replace it with a suitable line feed. I wrote the following batch file, but keep getting errors:
for fileName in $(ls *.txt): do
cat $fileName | sed s/^M//g >tmp && mv tmp $fileName
./rename.sh: line 3: syntax error near unexpected token `cat'
Seems simple enough... What am I missing? Thanks!
How to use Vi to match a string of text, add a new line, insert string...
location: linuxquestions.com - date: July 18, 2012
So I need to know how to Match a given string of text (at the begining of a line), move to the end of the line, add a new line, then add a given string. Example Below:
"dn: blah blah blah
"dn: blah blah blah
I am trying to modify a ldif dump. Thing is there is about 80 places I would need to insert "changeType: add". All lines beginning with "dn:" are unique and are specific to the security group that I am trying to import to my new SBS 2011 server.
Thanks for the help guys
Java bufferedreader how to read carriage return/new line sent over network from C
location: linuxquestions.com - date: January 20, 2012
Basically, I have a server in C that is sending a string of text over the using write. Then I have a client written in Java that is receiving the string and updating the text in a JTextArea. The problem I am having is that when I send the string, all carriage returns or new lines are lost and its just sending it as one long line. Does anyone know how to fix this or a little workaround hack for it?
C server code:
No new line at end of file? What does this mean?
location: linuxquestions.com - date: January 24, 2005
I am messing around with cpp and I typed up this simple code:
// first C++ program
int main ()
cout <<" Hello World!";
Then I do cpp test.cpp
and lots of stuff flies by on the screen and I get the error: test.cpp:9:2: warning: no newline at end of file.
should I be using something else other than cpp progname.cpp?
Is there a way to do away with this errror?
I am using cpp version 3.3.4
putty is not converting "\n" to a new line??? how can I fix this???
location: linuxquestions.com - date: January 19, 2009
I'm using Putty to remote in. What's really annoying is that it is showing "\n" in the response text instead of rendering this as a new line.
How could I fix this?
Is this a Putty configuration issue (can't quite see the setting), or something on my server end?
thanks in advance
Page: 1 2 3 4 5 6 7 8 9 10