{1:F195}{2:O5350646}{3:{1028:076}}{4: :16R:GL :16R:ADD :19A::P//U9,1 :16S:AFO -}{5:{MAC:00}{CHK:1C}}{S:{SAC:}{COP:S}{MAN:P2}}${1:33339}{2:O53}{4: :16S:G :16R:A :19A::H0, :19A::H0, :16S:ADDINFO -}{5:{MAC:0}{CHK:4}}{S:{SAC:}{COP:S}{MAN:GP2}} {1:F195}{2:O5350646}{3:{1028:076}}{4: :16R:GL :16R:ADD :19A::P//U9,1 :16S:AFO -}{5:{MAC:00}{CHK:1C}}{S:{SAC:}{COP:S}{MAN:P2}}${1:33339}{2:O53}{4: :16S:G :16R:A :19A::H0, :19A::H0, :16S:ADDINFO -}{5:{MAC:0}{CHK:4}}{S:{SAC:}{COP:S}{MAN:GP2}} Now iI want to split this single file into two files based on the delimeter $delimiter $ and then remove the delimeterdelimiter also. Any help would be greatly appreciated :)
iI have used the following logic first at every occurence of $ go to a new line im able to create multiple files but those are having delimeters.:
FILE=test.dat - First at every occurrence of
$go to a new line. - I'm able to create multiple files but those are having delimiters.
sed 's/$/\n&/g' $FILE > Inter_$FILE FILE=Inter_$FILECode:
FILE=test.dat sed 's/\$/\n&/g' $FILE > Inter_$FILE FILE=Inter_$FILE cat $FILE | while read line do sleep 1 FormattedDate=date +%Y%m%d%H%M%S Final_FILE=New_${FormattedDate}_$FILE
do sleep 1 FormattedDate=`date +%Y%m%d%H%M%S` Final_FILE=New_${FormattedDate}_$FILE echo "line --- $line" echo "FormattedDate --- $FormattedDate" Line_Check=`echo $line | tr '$' '@' | cut -c1` ##Line_Check=`sed -e 's/\$/@/g' $line | cut -c1` echo "Line_Check --- $Line_Check" echo "Final_FILE --- $Final_FILE" if [ "$Line_Check" = "@" ] then Final_FILE=New_$FormattedDate_$FILE FILE=$Final_FILE echo "FOUND In --- $line" echo "FILE --->>> $FILE" else FILE=$Final_FILE echo "FILE --->>> $FILE" ###`echo $line | cut -c2-` >> ###cat $line` >> $FILE ###Filter_Line=`echo $line` ###echo "Filter_Line --- $Filter_Line" fi echo $line >> $FILE ###sed 's/^@//' $FILE > 3_$FILE done
done sed 's/^\$//' $FILE >> Final_$FILE; */