cut or remove command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers cut or remove command
# 1  
Old 02-21-2011
cut or remove command

hi,

I want to remove first word in all files where first and second word is seperated by comma.

example: a file contains Apple,mango.

i need only mango shoule be there in the file???

Apple, should be removed!!!!!


can anyone help me out???

thanks in advance,
Arun ManasSmilie
# 2  
Old 02-21-2011
Hi Arun,

I think this Helps


PHP Code:
echo "Apple,mango" awk -"," '{print $2}' 
# 3  
Old 02-21-2011
consider the apple,mango is the first line inside the file. also each file has different text in the first line.

so how can i handle this issue????

regards,
Arun ManasSmilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Cut command: can't make it cut fields

I'm a complete beginner in UNIX (and not a computer science student either), just undergoing a tutoring course. Trying to replicate the instructions on my own I directed output of the ls listing command (lists all files of my home directory ) to My_dir.tsv file (see the screenshot) to make use of... (9 Replies)
Discussion started by: scrutinizerix
9 Replies

2. UNIX for Dummies Questions & Answers

Cut command doesn't remove (^C) character from only first line

I have a file which has first 2 junk characters(X^C) at beginning of each line in file. When i run cut -c 2- filename it removes junk characters from all lines except on first line it keeps one junk character control C(^C). Not sure why it is not removing only from first line. (2 Replies)
Discussion started by: later_troy
2 Replies

3. Shell Programming and Scripting

Cut text from a file and remove

Hello Friends, I am stuck with the below problem.Any help will be appreciated. I have a file which has say 100 lines. On the second last line I have a line from which i want to remove certain characters.. e.g CAST(CAST( A as varchar(50)) || ',' || CAST(CAST( B as varchar(50)) || ',' ||... (8 Replies)
Discussion started by: vital_parsley
8 Replies

4. UNIX for Dummies Questions & Answers

Cut pid from ps using cut command

hay i am trying to get JUST the PID from the ps command. my command line is: ps -ef | grep "mintty" | cut -d' ' -f2 but i get an empty line. i assume that the delimiter is not just one space character, but can't figure out what should i do in order to do that. i know i can use awk or cut... (8 Replies)
Discussion started by: ran ber
8 Replies

5. Shell Programming and Scripting

CSV with commas in field values, remove duplicates, cut columns

Hi Description of input file I have: ------------------------- 1) CSV with double quotes for string fields. 2) Some string fields have Comma as part of field value. 3) Have Duplicate lines 4) Have 200 columns/fields 5) File size is more than 10GB Description of output file I need:... (4 Replies)
Discussion started by: krishnix
4 Replies

6. Shell Programming and Scripting

Cut Command error cut: Bad range

Hi Can anyone what I am doing wrong while using cut command. for f in *.log do logfilename=$f Log "Log file Name: $logfilename" logfile1=`basename $logfilename .log` flength=${#logfile1} Log "file length $flength" from_length=$(($flength - 15)) Log "from... (2 Replies)
Discussion started by: dgmm
2 Replies

7. Shell Programming and Scripting

command to cut

hello , i am grepping for a variable which looks like this... washome=/home/etc/config/was how can i cut the the above like which removes washome= so that i will get /home/etc/config/was Thanks (3 Replies)
Discussion started by: nagendramv
3 Replies

8. UNIX for Dummies Questions & Answers

using cut command

I am new to unix ... I have a file with name unixile.123761 I need to cut the extension from this file name? can u help me for this i have tried like follows copied the file lo one variable v and then `echo $v | grep cut -d = -f 1` (8 Replies)
Discussion started by: shika123
8 Replies
Login or Register to Ask a Question