Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read line from file after marker and ignore characters before - can this be done? 1

Status
Not open for further replies.

bazil2

Technical User
Feb 15, 2010
148
DE
(Elementary user)

I am using this syntax in a csh to read the first (and only) line in a file called group:


foreach line ( "`cat /path/to/my/user/group`" )
echo $line
end


It returns the value primary:friends

It there a way of changing the syntax to ignore the word primary and the colon, i.e., everything to the right of ':'?

Is that possible?

Best regards
 
Completely brilliant!

Thank you so much; I've never heard of this command before, but given my experience, that's not surprising!

I understand, the ':' becomes a delimiter or marker and splits the text into fields, f1 being everything up to the marker and f2 everything afterwards.

Best regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top