cut all the names with .c and .h


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers cut all the names with .c and .h
# 1  
Old 08-17-2010
cut all the names with .c and .h

Hello All,

I have one file which contains the line like this:

c:\old\DIR_source\NEW\new_icon.c@@\main\CHANGE\600_int\1
C:\old\DIR_source\NEW\COM\new_COM.c@@\main\CHANGE\a600_int\1

I want to cut these two things from each line:

DIR_source\NEW\new_icon.c ---- It should be in one variable....
main\CHANGE\600_int\1 ------ It should be in one variable...
# 2  
Old 08-17-2010
This will remove those strings from the file.
Code:
sed "s#old\DIR_source\NEW\new_icon.c##g;s#main\CHANGE\600_int\1##g" < infile > outfile

# 3  
Old 08-17-2010
I want a command which will cut the strings after c:\ till @
and from main to the end.

This command is ok.....
But i cant use the word like this:

Code:
old\DIR_source\NEW\new_icon.c##g;s#main\CHANGE\600_int\1

the command should be flexible to do it for each line.
# 4  
Old 08-17-2010
Quote:
Originally Posted by suvenduperl
I want a command which will cut the strings after c:\ till @
and from main to the end.
Well now we know. Smilie

Code:
sed -r "s#c:\[^@]+#c:\#g;s#main.*##g"

 
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using :<<cut / cut to comment out block of bash script

I am using : << cut / cut to comment out block of code. Works fine on few lines of script, then it gives me this cryptic error when I try to comment out about 80 lines. The "warning " is at last line of script. done < results 169 echo "END read all positioning parameters" 170... (8 Replies)
Discussion started by: annacreek
8 Replies

2. 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

3. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

4. 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
Login or Register to Ask a Question