Removing un-necessary start string


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Removing un-necessary start string
# 1  
Old 05-31-2012
Removing un-necessary start string

i have input in below form

Code:
part=gfjhwhedaqh=ghdgwg^*^(G==

i want to remove the starting "part=" and retain the remaining. please suggest
# 2  
Old 05-31-2012
Code:
newstr=`echo "part=gfjhwhedaqh=ghdgwg^*^(G=="|cut -d"=" -f2-`

This User Gave Thanks to donadarsh For This Post:
# 3  
Old 05-31-2012
Quote:
Originally Posted by donadarsh
Code:
newstr=`echo "part=gfjhwhedaqh=ghdgwg^*^(G=="|cut -d"=" -f2-`

thanks. just to add how do i interpret the "-" after -f2
# 4  
Old 05-31-2012
Code:
str='part=gfjhwhedaqh=ghdgwg^*^(G=='
newstr=${str#part=}

# 5  
Old 05-31-2012
Quote:
Originally Posted by skyineyes
thanks. just to add how do i interpret the "-" after -f2
Code:
-f2-

means from field 2nd to last. If i say
Code:
-f2-f4

it means from field 2nd to field 4th.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing string from CSV file by provide removal string from other file

What I need is to remove the text from Location_file.txt from each line matching all entries from Remove_location.txt Location_file.txt FlowPrePaid, h3nmg1cm2,Jamaica_MTAImageFileFlowPrePaid,h0nmg1cm1, Flow_BeatTest,FlowRockTest FlowNewTest,FlowNewTest,h0nmg1cm1 PartiallySubscribed,... (3 Replies)
Discussion started by: ketanraut
3 Replies

2. Shell Programming and Scripting

Replace String at the start of each line

Replace String at the start of each line (3 Replies)
Discussion started by: Mahesh_RPM
3 Replies

3. Shell Programming and Scripting

Remove lines between the start string and end string including start and end string Python

Hi, I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
Discussion started by: Dabheeruz
1 Replies

4. Shell Programming and Scripting

how to specify start and stop of a search string

I am trying to extract a string from a line of text. Currently I am using grep -o 'startofstring(.........' The string is not always the same size. The string I'm trying to extract starts with 'test(' ends with ')'. ex "blah,blah,blah,test(stringoftext),blah blah" How do I... (4 Replies)
Discussion started by: jeepguy
4 Replies

5. Shell Programming and Scripting

Join lines with the same start string

I have the text like: DN11-001 Thats the first line which needs to be DN11-001 joined with the second line and also to DN11-001 the third line as they all begin with the same DN11-001 document number. DN11-002 The number of lines differ DN11-002 among the documents. DN11-005 It can also be... (10 Replies)
Discussion started by: andrejm
10 Replies

6. Shell Programming and Scripting

Append string at start of line

Hi, I want to append # at the start of line wherever keyword xyz is found through stream editor? Is it possible? (18 Replies)
Discussion started by: db2cap
18 Replies

7. Programming

Help with removing \n from a string in C

void remove_new_line(char *s) { while (*s) { if (*s == '\n') { *s='\0'; } s++; } } // i tried this code for removing a \n from a string but its not working (12 Replies)
Discussion started by: omega666
12 Replies

8. Shell Programming and Scripting

Appending string, variable to file at the start and string at end

Hi , I have below file with 13 columns. I need 2-13 columns seperated by comma and I want to append each row with a string "INSERT INTO xxx" in the begining as 1st column and then a variable "$node" and then $2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13 and at the end another string " ; COMMIT;" ... (4 Replies)
Discussion started by: Vaddadi
4 Replies

9. Shell Programming and Scripting

String start with ABC

Hi, How to find out the words starting with ABC in a file (K shell) I dont want the word having ABC in middle of any string. Thanks Subrat (1 Reply)
Discussion started by: subrat
1 Replies

10. Shell Programming and Scripting

removing a delimiter at the start of row

I Have this code while do column1=":`cat /home/test_inter.txt|head -${iCount1}|tail -1|cut -d "," -f2`" columnA=$columnA$column1 iCount1=`expr ${iCount1} + 1` done echo $columnA (2 Replies)
Discussion started by: nvuradi
2 Replies
Login or Register to Ask a Question