Sponsored Content
Top Forums Shell Programming and Scripting How to test if part of a string matches? Post 302362746 by fpmurphy on Saturday 17th of October 2009 09:16:23 AM
Old 10-17-2009
works in either bash or ksh93
Code:
name=backup.12345678
[[ ${name:0:7} == backup. ]] && echo "yes"

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

to create foder when the string matches

hi :) im actually new to shell script ,see here is the program wat it will do is .. i have to create folder at the run time when the string matches ... what to do is im havin text file which carry the file name like ( EngCVer1pg1j01.TOP, EngCVer1pg1m08.TOP, EngCVer1pg1h04,..and... (1 Reply)
Discussion started by: maximas
1 Replies

2. Shell Programming and Scripting

creating folder when the string matches

hi :confused:sorry last time , b4 im drafting the thread i was unexpectedly posted the thread see here is the program wat it will do is .. i have to create folder at the run time when the string matches ... what to do is im havin text file which carry the file name like ( EngCVer1pg1j01.TOP,... (2 Replies)
Discussion started by: maximas
2 Replies

3. Shell Programming and Scripting

Replace Entire line if any part matches regexp

Hey guys, I have a file that I've slowly been awking, seding, and greping for data entry. I am down to pull the addresses out to insert them into an excel file. Each address is a few lines, but i want to put a semicolon delimiter in between each address so I can export the text file into excel and... (6 Replies)
Discussion started by: Cocoabean
6 Replies

4. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies

5. Shell Programming and Scripting

Get line number when matches a string

If I have a file something like as shown below, ARM*187878*hjhj BAG*88778*jjjj COD*7777*kkkk BAG*87878*kjjhjk DEF*65656*89989*khjkk I need the line numbers to be added with a colon when it matches the string "BAG". Here in my case, I need something like ARM*187878*hjhj... (4 Replies)
Discussion started by: Muthuraj K
4 Replies

6. Shell Programming and Scripting

How to check weather a string is like test* or test* ot *test* in if condition

How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies

7. UNIX for Dummies Questions & Answers

Print only '+' or '-' if string matches (two files)

I would like to add two additional conditions to the actual code I have: print '+' if in File2 field 5 is greater than 35 and also field 7 is grater than 90. while read -r line do grep -q "$line" File2.txt && echo "$line +" || echo "$line -" done < File1.txt ' Input file 1: ... (5 Replies)
Discussion started by: bernardo.bello
5 Replies

8. Shell Programming and Scripting

Display text is string matches below.

I have not idea how I would accomplish this. I have a script that scans for CDP neighbours. I get the results in a file. I am interested in CDP Neighbor Details if name BSWITCH shows up. If BSWITCH is not present then skip. CDP Neighbor Details for 10.200.21.1... (1 Reply)
Discussion started by: mrlayance
1 Replies

9. Shell Programming and Scripting

Replace string of a file with a string of another file for matches using grep,sed,awk

I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: --> cat comp.pkglist Package list: nss-util-devel-3.28.4-1.el6_9.x86_64 Version Change: 3.28.4 -->... (1 Reply)
Discussion started by: Paras Pandey
1 Replies
BACKUP_HELP(8)						       AFS Command Reference						    BACKUP_HELP(8)

NAME
       backup_help - Displays help for backup commands

SYNOPSIS
       backup help [-topic <help string>+] [-admin] [-help]

       backup h [-t <help string>+] [-a] [-h]

DESCRIPTION
       The backup help command displays the complete online help entry (short description and syntax statement) for each operation code specified
       by the -topic argument. If the -topic argument is omitted, the output includes the first line (name and short description) of the online
       help entry for every backup command.

       To list every backup command whose name or short description includes a specified keyword, use the backup apropos command.

OPTIONS
       -topic <help string>+
	   Indicates each command for which to display the complete online help entry. Omit the backup part of the command name, providing only
	   the operation code (for example, specify dump, not backup dump). If this argument is omitted, the output briefly describes every backup
	   command.

       -help
	   Prints the online help for this command. All other valid options are ignored.

OUTPUT
       The online help entry for each backup command consists of the following two or three lines:

       o   The first line names the command and briefly describes its function.

       o   The second line lists aliases for the command, if any.

       o   The final line, which begins with the string "Usage", lists the command's options in the prescribed order. Online help entries use the
	   same symbols (for example, brackets) as the reference pages in this document.

EXAMPLES
       The following example displays the online help entry for the backup dump command:

	  % backup help dump
	  backup dump: start dump
	  Usage: backup dump -volumeset <volume set name> -dump <dump level name>
	  [-portoffset <TC port offset>]  [-at <Date/time to start dump>+]
	  [-append]  [-n]  [-file <load file>]	[-help]

PRIVILEGE REQUIRED
       None

SEE ALSO
       backup(8), backup_apropos(8)

COPYRIGHT
       IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.

       This documentation is covered by the IBM Public License Version 1.0.  It was converted from HTML to POD by software written by Chas
       Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.

OpenAFS 							    2012-03-26							    BACKUP_HELP(8)
All times are GMT -4. The time now is 08:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy