Find all palindromes of four characters or less


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find all palindromes of four characters or less
# 1  
Old 12-09-2005
Find all palindromes of four characters or less

I got this far that is the code searches the bigtextfile for words with 4 characters or less then store those characters to a palindromes text file. The problem I am having is that I don't know how to find the palindromes. The 4 character words that are stored to palidromes text file must be a palindrome word. Any help is appreciated.

awk '{

for(i=1;i<=NF;i++)

{

if(length($i)<5)

{print $i}

}

}' bigTextFile.txt > palindromes.txt

Last edited by darklord12; 12-09-2005 at 09:54 PM..
# 2  
Old 12-09-2005
Maybe you should ask your teacher.

(thread closed)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find out the weird blank characters?

I have a text file downloaded from the web, I want to count the unique words used in the file, and a person's speaking length during conversation by counting the words between the opening and closing quotation marks which differ from the standard ASCII code. Also I found out the file contains some... (2 Replies)
Discussion started by: yifangt
2 Replies

2. Programming

Find first 5 characters in the file name

Hi, I have some files in a folder. I need to find first 5 characters in the file name of every file and write those into a file. Example: ABC126_ACCPT.txt AYA127_ACCPT.txt Output in the file: ABC126 AYA127 (3 Replies)
Discussion started by: nani1984
3 Replies

3. Shell Programming and Scripting

Find new line characters in a file

Hi All, I need to find new line characters in a file and their location in the file and print the results. can someone pleas help. KM (4 Replies)
Discussion started by: Kevin Tivoli
4 Replies

4. Shell Programming and Scripting

Find out match characters on all lines

I have a file with 22 lines. Each line has only 5 different chars, no white space, and each line is 3,278,824 in length. The 5 chars is "-", "A", "B", "C", "D". Below is an example of the first 25 chars of the first four lines of the file. -----ABCDA--CD-BBBBB----D --A--ABCD--DCD-BBBBC-----... (12 Replies)
Discussion started by: cwzkevin
12 Replies

5. Shell Programming and Scripting

Need to find lines where the length is less than 50 characters

Hi, I have a big file say abc.csv. And in that file, I need to find lines whose length is less than 50 characters. How can it be achieved? Thanks in advance. Thanks (4 Replies)
Discussion started by: Gangadhar Reddy
4 Replies

6. Shell Programming and Scripting

HOw to find special characters

I have flat file which has data like this glid¿as_liste¿025175456 How can I print these lines into new file? (4 Replies)
Discussion started by: sol_nov
4 Replies

7. UNIX for Dummies Questions & Answers

Find in Files (special characters)

Well, I've searched the forum, but couldn't find an option, that would help me. I'm really a dummie in unix, so here it goes. I've got like 50k files in a single catalogue. One of them contains a string: Including the box/square brackets. I tried to find it manually, and use some search... (2 Replies)
Discussion started by: kalik
2 Replies

8. UNIX for Dummies Questions & Answers

Using grep to find one or more characters

Hi I am a little stuck using grep. I want to be able to find from a file all lines which have the sequence of characters t, followed by any character, followed by the characters ing. I have tried looking at the man pages for help, but did not understand it correctly (as it is not the most... (9 Replies)
Discussion started by: rushhour
9 Replies

9. AIX

How to find special characters??

By more, vi, cat etc commands special characters (few control characters) are not identified. Is there any way to find out those? Thanks Sumit (3 Replies)
Discussion started by: sumitc
3 Replies

10. Shell Programming and Scripting

Script to find and remove characters

Hi. I have many files in a folder, and even more in the subfolders. I need a script that finds and removes certain characters (them being /n in this one) in the files in the folder and it's subfolders. So, could someone write me a script that works in Linux, does this: Searchs for "/n" in... (5 Replies)
Discussion started by: Zerby
5 Replies
Login or Register to Ask a Question