Search Results

Search: Posts Made By: Aswex
1,908
Posted By greet_sed
Use this: basename /dir1/dir/2/dir3/
Use this:
basename /dir1/dir/2/dir3/
841
Posted By vbe
I wonder if your issue is not network related......
I wonder if your issue is not network related... Am I seeing a NFS mount? ... If so not a good idea...
Forum: Solaris 08-08-2013
1,213
Posted By Just Ice
so what is the reason to connect to the serial...
so what is the reason to connect to the serial port if you already have console access with the monitor and the keyboard?

anyways, new solaris servers used to ship with silver-colored null modem...
Forum: Solaris 08-07-2013
1,213
Posted By DukeNuke2
Should be no problem to connect to the serial...
Should be no problem to connect to the serial port of an U10. Done that a lot... You'll need a null modem (https://en.wikipedia.org/wiki/Null_modem) cable and you should be set.
2,615
Posted By rangarasan
You have to do some more bit with radoulov's...
You have to do some more bit with radoulov's solution like this.

while read line
do
printf '%s\n' "${line%_*}_"
done <"input_file"


(or)

Try this sed,

sed 's/_[^_]*$/_/' input_file...
2,615
Posted By radoulov
sed 's/[0-9]*\.csv$//' infileAnd perhaps in most...
sed 's/[0-9]*\.csv$//' infileAnd perhaps in most cases this will be sufficient:

sed 's/[0-9]*.csv//' infileor:
sed 's/.\{12\}$//' infileActually, for fixed length prefixes you could use cut -c1-n...
1,959
Posted By anbu23
for file_nm in * do ext=${file_nm##*.} mv...
for file_nm in *
do
ext=${file_nm##*.}
mv $file_nm ${file_nm%_*}"_"$(date +%Y%m%d)"."${ext}
done
1,959
Posted By PikK45
Considering all the filenames will have the same...
Considering all the filenames will have the same YYYYDDMM in their names, you can loop 'em all :)

ls | while read file
do
newfile=$(echo $file | sed 's/20130323/20130324/g' )
mv $file $newfile...
2,063
Posted By durden_tyler
$ $ cat f72 New File: 95106 Oct 23...
$
$ cat f72
New File: 95106 Oct 23 TAG__KSM__2012292_0.TAB
New File: 79530 Oct 22 TAG__KSM__2012293_0.TAB
_+_ File: 94710 Oct 21 TAG__KSO__2012290_0.TAB
New File: 95040 Oct 20...
1,409
Posted By pamu
@elixir - Sort with fields wont work here as...
@elixir - Sort with fields wont work here as position of strings are not the same and _ also not the same..

awk -F "2012" '{print $2,$0 }' file | sort -n | cut -d' ' -f2-
1,409
Posted By elixir_sinari
sort -t_ -n -k 5.5,5.7 file
sort -t_ -n -k 5.5,5.7 file
1,703
Posted By RudiC
On my linux/mawk system it will compare sizes OK....
On my linux/mawk system it will compare sizes OK. If it doesn't on yours, force it to be numerical like$5+0 > Ar[$9]+0. For a third rule, you copy the entire comparing line and invert the comparison....
1,147
Posted By elixir_sinari
With sed: sed -n 's/;\{1,\}$//;s/^[ \t]*//;s/[...
With sed:
sed -n 's/;\{1,\}$//;s/^[ \t]*//;s/[ \t]*'"'"'//gp' infile
1,147
Posted By bartus11
Try: perl -p0e 's/\047//g;s/...
Try: perl -p0e 's/\047//g;s/ //g;s/^\*.*\n//m;s/^;;.*//ms;s/;;//' file
1,207
Posted By balajesuri
if [ ! -f ${File} ]; then Control; fi
if [ ! -f ${File} ]; then Control; fi
1,207
Posted By itkamaraj
[ ! -f ${File} ] && Control or ...
[ ! -f ${File} ] && Control


or


[ -f ${File} ] || Control
10,077
Posted By cero
There's a useless use of cat in your code, and...
There's a useless use of cat in your code, and variablenames are case-sensitive. For the messages you can use the && and || operators (tested with bash-shell).
ControleDir () {
while read...
10,077
Posted By rangarasan
mkdir
You can use mkdir -p DIR2/DIR3/DIR4/DIR5.
or else you can loop around this command for all the input.

You dont need to check the directory and create the directory.
-p option create dir not...
2,206
Posted By ygemici
# awk -F"/[^A-Za-z0-9]*" '{$2=$NF="";gsub(" |...
# awk -F"/[^A-Za-z0-9]*" '{$2=$NF="";gsub(" | $","");gsub(" ","/")}1' data
DIR2/DIR3
DIR2
DIR2/DIR3/DIR4/DIR5
2,206
Posted By balajesuri
To get rid of dir1 and filename: sed...
To get rid of dir1 and filename:

sed "s:/[^/]*/::; s:/[^/]*$::" inputfile


--------------------------------------------------
Woh! Already answered by two members!
2,206
Posted By Scott
A sed one: $ sed "s|/[^/]*/\(.*\)/.*|\1|"...
A sed one:

$ sed "s|/[^/]*/\(.*\)/.*|\1|" file
DIR2/DIR3
DIR2
DIR2/DIR3/DIR4/DIR5
2,206
Posted By rangarasan
bash
Hi,

Try this one,


#! /usr/bin/bash
while read line
do
line=${line%\/*}
line=${line#\/*\/}
echo $line >>file.new
done <file


Look at the sed and awk solutions too :)


awk...
1,679
Posted By drl
Hi. It's better to state your OS, shell,...
Hi.

It's better to state your OS, shell, etc. upfront rather than as an afterthought.

On my system:
% ksh
$ paste -d'\n' <( ls -1 l*.txt ) <( ls -1 f*.arch )...
1,679
Posted By drl
Hi. Shuffling: #!/usr/bin/env bash #...
Hi.

Shuffling:
#!/usr/bin/env bash

# @(#) s1 Demonstrate paste used a shuffle mechanism.

pe() { for _i;do printf "%s" "$_i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
db() { (...
2,742
Posted By CarloM
Ah, I thought the tar lines had today's date in...
Ah, I thought the tar lines had today's date in them.

Try this:
awk -vADATE=$(date +%Y/%m/%d) '/ARCHIVER/ {inside=0} $0 ~ ADATE {inside=1} /tar:.*: No such file or directory/ { if (inside==1)...
Showing results 1 to 25 of 73

 
All times are GMT -4. The time now is 05:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy