I just try to simplify to be the clearest as possible.
lines in my file.txt look like that:
xxxxyyyyyyyyyyzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
where:
"xxxx" can be any number between 0000 and 9999 (but I don't need it),
"yyyyyyyyyy" is the string that I want to extract only if one of the 50 patterns is present in "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz".
"xxxx" are numbers,
"yyyyyyyyyy" and "zzzzzzzzzzzzzzzzzzzzz" can contain anything (number, letters, symbols).
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Quote:
Originally Posted by balajesuri
...
5. And please indent your script.
...
Hi.
The OP (and others) can kill two birds with one stone by using utilities like bashtidy, or simple token-counting (stacking-unstacking) codes:
producing:
Note that bashtidy diagnoses the missing done as an indent/outdent error. For short codes (as many scripts are), that and the indentation are often enough to find the problem, and one gets a nicely indented script into the bargain.
The bashtidy utility is written in ruby and is available as noted in the demonstration script comments.
I think I have used it on ksh and zsh scripts, as long as they don't use features peculiar to those shells. I don't use a plain sh, but that's a very basic subset of bash, etc., so I am confident that it would work on sh scripts as well -- almost any Bourne-shell-family variant.
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Hello all,
I am running a script to generate a report and mail it to an email address.
When I am trying to validate whether the file is a 0 kb file, I am getting the below error.
Error: "Syntax error; unexpected end of file"
Any suggestions please?
Code:
#!/bin/sh
.... (1 Reply)
This is a script I got off the web for transferring Safari's "reading list" to the Pocket app. I ran it in terminal with the command bash exportsafarireadinglist.sh and got syntax error: unexpected end of file. Thanks for any help! The code:
#!/bin/bash
# Script to export Safari's reading... (2 Replies)
While i m running below code, it is giving me the error"syntax error at line 15: `end of file' unexpected".
Pls let me know what is wrong here..i tried many ways, but no luck
dbSID="SWQE"
usrname="apps"
password="Wrgthrk3"
count=0
while
do
sqlplus $usrname/$password@$dbSID... (5 Replies)
Hi All,
Please hav a look at the below peice of script and let me know if there are any syntax errors.
i found that the below peice of Script is causing issue. when i use SFTP its working fine, but there is a demand to use FTP only. please find below code and explain if anything is wrong... (1 Reply)
Hi Techies,
can anyone please debug the following Script and let me know what is going wrong here.
im getting the following error
#!/usr/bin/bash
# ##############################################################################################
#
# Variables
#
#... (2 Replies)
Well, this is a very crazy issue, and I'm scratching my head to find a solution.
This is a simple code to tranfer a file, in my main script I need to add a conditional statement (IF/THEN) like the below example:
#!/bin/bash
if ; then
ftp -inv "192.168.1.10" << EOFTP
user... (8 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
I have a trouble in my script when i use EOF inside block if.
If i use EOF whitout block if I donīt have problem.
Guys any ideas?
Sorry for my terrible English.
#!/bin/sh
set -xv
HOST='ftp.fiction.com.br'
USER='fictionuser'
PASS='fictionpass'
FILE='ftpteste.txt'
busca=`find... (4 Replies)