Search Results

Search: Posts Made By: makan
9,393
Posted By Arun_Linux
use a while loop. while true do echo...
use a while loop.

while true
do
echo "enter directory for output file [e.g: /home/admin/dst/]:"
read OUTPUTFILE
if [ ! -d $OUTPUTFILE ] ;
then
echo "ERROR: invalid...
1,200
Posted By pamu
Try something like this.. [ ! -d test_2 ]...
Try something like this..


[ ! -d test_2 ] && mkdir test_2 || touch test_2/test.txt
5,202
Posted By raj_saini20
awk...
awk 'FNR==4{split(FILENAME,a,"_");dt=a[6]"_"a[7]"_"substr(a[8],1,4);print dt","$0}' Bounce*
5,202
Posted By itkamaraj
$ nawk 'BEGIN{print FILENAME}' a.txt a.txt ...
$ nawk 'BEGIN{print FILENAME}' a.txt
a.txt

FILENAME - The name of the current input file. If no files are specified on the command line,the value of FILENAME is "-". However, FILENAME is...
5,202
Posted By elixir_sinari
Try (not tested): awk 'FILENAME!=prevfile{ ...
Try (not tested):
awk 'FILENAME!=prevfile{
match(FILENAME,/[0-9]{2}_[A-Z][a-z]{2}_[0-9]{4}/)
dt=substr(FILENAME,RSTART,RLENGTH)
prevfile=FILENAME}
FNR>=4{print dt "," $0}'...
5,202
Posted By mirni
for i in *.csv ; do echo $(basename $i...
for i in *.csv ; do
echo $(basename $i .csv | cut -d_ -f6-),$(tail -1 $i)
done > output.csv
5,202
Posted By pamu
Use below code to give date from the file name...
Use below code to give date from the file name into the file entry...

As you have not clearly mentioned how you want the output of your csv, You can just add what you want to add(just grep after...
8,025
Posted By raj_saini20
awk 'BEGIN {FS="[/,:...
awk 'BEGIN {FS="[/,: ]"}{$4=($6=="PM"?($4==12?$4:$4+12):($4==12?0:$4)); $6=""} {print $1"/"$2"/"$3","$4":"$5}'

for 24Hrs conversion
8,025
Posted By elixir_sinari
The variable latestb must be containing "/"...
The variable latestb must be containing "/" characters. This is confusing sed as you have used "/" as the delimiters for s, pattern, replacement and flags. Try:
sed -e "s:changeme:$latestb:g"...
15,765
Posted By itkamaraj
$ echo "Jan" | awk 'BEGIN{months=" ...
$ echo "Jan" | awk 'BEGIN{months=" JanFebMarAprMayJunJulAugSepOctNovDec"}{print index(months,$0)/3}'
1
$ echo "Feb" | awk 'BEGIN{months=" JanFebMarAprMayJunJulAugSepOctNovDec"}{print...
8,476
Posted By adderek
Try searching for my posts - I gave some...
Try searching for my posts - I gave some instructions about this.
But in short way:

USE:
"${variable}"
instead of
$variable
Showing results 1 to 11 of 11

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