script to cut a word from the file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script to cut a word from the file
# 1  
Old 02-23-2009
script to cut a word from the file

hi to all

i wrote a script to cut a word from the file....that works only if the word is fixed field.

example..
sed -n '1p'|awk '{ print $2 }'|cut -d '(' -f2|sed 's/(//'|sed 's/)//'|sed 's/"//g' filename

i know that word is starting with "app" then "(" ----> ex: app("xxxx").

it works when the value came in second field.. if the value is in 5or 6 filed it will fail. but, i need to capture the value where ever it is and the value is not fixed. if it is fixed i can cut the value.. but it is not fixed.

any ideas....

thanks

Last edited by honeym210; 02-24-2009 at 12:41 AM..
# 2  
Old 02-24-2009
Please post an example of the input and desired output.
# 3  
Old 02-24-2009
thanks Zaxxon--

i don't have any example.

but, they use this word in post validation script.
my part is just to cut the value from the script.

thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Cut a word between two strings and repeat the same in the entire file

in the below data i need to search for the word typeMismatch and then traverse back to find the filename of that particular mismatch. Like this we have to get all the file names which has error in them. How can i acheive this. I tried use sed or awk but not able to achevie the same. Sample... (2 Replies)
Discussion started by: ATWC
2 Replies

2. UNIX for Beginners Questions & Answers

UNIX script to check word count of each word in file

I am trying to figure out to find word count of each word from my file sample file hi how are you hi are you ok sample out put hi 1 how 1 are 1 you 1 hi 1 are 1 you 1 ok 1 wc -l filename is not helping , i think we will have to split the lines and count and then print and also... (4 Replies)
Discussion started by: mirwasim
4 Replies

3. UNIX for Advanced & Expert Users

use a word as a delimiter with cut

Is there a way to use a word as a delimiter with cut? Or is there a way to use sed or awk with a word as a delimiter? I don't care which program I use for a delimiter I just want to use a word as a delimiter. (2 Replies)
Discussion started by: cokedude
2 Replies

4. Shell Programming and Scripting

cut the first word in the file

how to cut the first word in multiple file at a time i.e)1st row and 1st colum word in multiple files (6 Replies)
Discussion started by: natraj005
6 Replies

5. Shell Programming and Scripting

Script to cut the first word in Message Text

Hi, In my shell script, I am connecting to database and querying multiple columns in a table. MESSAGE_TEXT=`sqlplus -s /nolog <<end_log_stmt set heading off set feedback off set verify off set termout off set pages 0 CONNECT APPS/$USER_PWD Select order_number, id, error_message... (6 Replies)
Discussion started by: balajiora
6 Replies

6. Shell Programming and Scripting

Help need to cut the first word of a line in text file

Hi All, I would like help with a script which can get rid of the first work of all lines in text file. File 1 The name is Scott. Output : name is Scott ---------- Post updated at 02:38 PM ---------- Previous update was at 02:37 PM ---------- Hi ALL There is typo error in... (3 Replies)
Discussion started by: bubbly
3 Replies

7. Shell Programming and Scripting

Sed or awk cut all lines after word

Hi, sorry for newbie question :confused: can't find how to cut ? from 1000 2000 word some text1.... 100 200 300 word some text2.... 10 20 30 abc word some text3.... to some text1.... some text2.... some text3.... (7 Replies)
Discussion started by: Trump
7 Replies

8. Shell Programming and Scripting

help with cut word

hi there i have this problem , i need cut the 4 first character and the 6 last characters of the word this is my file 'dg_bancdist_logs' 'dg_tibco_logs' 'dg_rmp_logs' 'dg_mig_logs' 'dg_titan_logs' 'dg_swift_logs' 'dg_isis_logs' 'dg_isisges_logs' and i need this ... (4 Replies)
Discussion started by: gonzo
4 Replies

9. Shell Programming and Scripting

cut last line of a word

Hi all, want to delete a crahecter from each line..? how can i do it... (2 Replies)
Discussion started by: bullz26
2 Replies

10. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies
Login or Register to Ask a Question