how to extract a paticular string from the text file with awk.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to extract a paticular string from the text file with awk.
# 1  
Old 10-14-2010
how to extract a paticular string from the text file with awk.

hello forum members

I have txt file which consists the following information.

Server: abababa.xyz.ap.mxmx.com
Address: 111.143.211.202
Name: rmxd.ipc.ap.mxmx.com
Address: 144.111.99.9

from the abovefile i have to extract only string "rmxd.ipc.ap.mxmx.com" through awk command. Iam looking forward from you.Smilie

Thanks & regards
rajkumar_g
# 2  
Old 10-14-2010
Code:
awk '/^Name:/{print $2}' file.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to change specific string to new value if found in text file

I am trying to use awk to change a specific string in a field, if it is found, to another value. In the tab-delimited file the text in bold in $3 contains the string 23, which is always right before a ., if it is present. I am trying to change that string to X, keeping the formatting and the... (3 Replies)
Discussion started by: cmccabe
3 Replies

2. Shell Programming and Scripting

Extract all text between the same matching string from a given column

Hello All, I have an input sample data like below (In actual I have many columns and few million rows). Column1,Column2 4,2 1,5 Hello,4 1,4 Hello,2 3,5 Hello,8 4,5 Need the output (using awk and/or sed preferably) like below. Here I need all the lines between 2 matching... (1 Reply)
Discussion started by: ks_reddy
1 Replies

3. Shell Programming and Scripting

To Search for a string and to extract the string from the text

Hi Team I have an huge xml where i need to search for a ceratin numbers. For example 2014-05-06 15:15:41,498 INFO WebContainer : 10 CommonServicesLogs - CleansingTriggerService.invokeCleansingService Entered PUBSUB NOTIFY MESSAGE () - <?xml version="1.0" encoding="UTF-8"... (5 Replies)
Discussion started by: Kannannair
5 Replies

4. Shell Programming and Scripting

How to extract text from STRING to end of line?

Hi I have a very large data file with several hundred columns and millions of lines. The important data is in the last set of columns with variable numbers of tab delimited fields in front of it on each line. Im currently trying sed to get the data out - I want anything beetween :RES and... (4 Replies)
Discussion started by: Manchesterpaul
4 Replies

5. Red Hat

To search for files of paticular file mask.

how to find files of particular mask from a folder using shell script. for example if i have to find whether files having file mask like FILE%N%.csv ie files like FILE123.csv or files like FILE56.csv are present in the following folder or not. l (2 Replies)
Discussion started by: ramsavi
2 Replies

6. Shell Programming and Scripting

Extract text from string

Dear community, I know, this is very stupid question, but I'm scratching my head to find a solution. I have a variable like this: var=" INFO : ABCDEFG"Now I need to remove the leading spaces and output the result like: echo "FIELD1 ; FIELD2 ; $RESULT ; FIELD4" ... (17 Replies)
Discussion started by: Lord Spectre
17 Replies

7. Shell Programming and Scripting

Awk to convert a text file to CSV file with some string manipulation

Hi , I have a simple text file with contents as below: 12345678900 971,76 4234560890 22345678900 5971,72 5234560990 32345678900 71,12 6234560190 the new csv-file should be like: Column1;Column2;Column3;Column4;Column5 123456;78900;971,76;423456;0890... (9 Replies)
Discussion started by: FreddyDaKing
9 Replies

8. Shell Programming and Scripting

Use grep sed or awk to extract string from log file and put into CSV

I'd like to copy strings from a log file and put them into a CSV. The strings could be on different line numbers, depending on size of log. Example Log File: File = foo.bat Date = 11/11/11 User = Foo Bar Size = 1024 ... CSV should look like: "foo.bat","11/11/11","Foo Bar","1024" (7 Replies)
Discussion started by: chipperuga
7 Replies

9. Shell Programming and Scripting

awk extract a string from a file

Hi, I have a file which has thousand of lines with lines starting with And I want to extract and show to user only the below string from all the lines Please note note that the above string is a time stamp and it would be different on all the lines. Please tell me how to extract... (8 Replies)
Discussion started by: jredx
8 Replies

10. Shell Programming and Scripting

How to extract text from string using regular expressions

Hi, I'm trying to use sed to extract some text and assign it to a variable. Can anyone provide me with some help? it would be much appreciated! I"m looking to extract for example: filename=/output/R34/2005_13_R34_C1042S_T83_CRFTXT_20081015.txt I'm trying to extract the 1042... (9 Replies)
Discussion started by: jtung
9 Replies
Login or Register to Ask a Question